Example usage for java.lang String toString

List of usage examples for java.lang String toString

Introduction

In this page you can find the example usage for java.lang String toString.

Prototype

public String toString() 

Source Link

Document

This object (which is already a string!) is itself returned.

Usage

From source file:nz.co.senanque.madura.configuration.SampleListener.java

public void configurationChanged(ConfigurationEvent arg0) {
    System.out.println("identifier: " + m_identifier);
    Configuration configuration = (Configuration) arg0.getPropertyValue();
    String s = configuration.getString(m_identifier);
    s.toString();
}

From source file:com.openshift.internal.restclient.model.Secret.java

@Override
public void setType(final String type) {
    get(SECRET_TYPE).set(type.toString());
}

From source file:pt.webdetails.cpf.session.PentahoSession.java

@Override
public void setParameter(String key, Object value) {
    userSession.setAttribute(key.toString(), value);
}

From source file:AIR.Common.Web.WebValueCollectionCorrect.java

@Override
public Object put(String key, Object value) {
    if (key == null || StringUtils.isEmpty(key.toString()) || value == null)
        return null;
    return super.put(key.toString(), value);
}

From source file:lab.example.service.MessageListener.java

public void run(String... args) throws JsonProcessingException {
    logger.info(args.toString());
}

From source file:com.github.jknack.handlebars.io.AbstractTemplateLoader.java

/**
 * Normalize the location by removing '/' at the beginning.
 *
 * @param location The candidate location.
 * @return A location without '/' at the beginning.
 *///from w ww  .  java  2  s.c o  m
protected String normalize(final String location) {
    if (location.toString().startsWith("/")) {
        return location.substring(1);
    }
    return location;
}

From source file:org.owasp.webgoat.plugin.introduction.SqlInjectionLesson6b.java

@RequestMapping(method = RequestMethod.POST)
@ResponseBody/*from  w w  w.  j  a  va 2 s.  com*/
public AttackResult completed(@RequestParam String userid_6b) throws IOException {
    if (userid_6b.toString().equals(getPassword())) {
        return trackProgress(success().build());
    } else {
        return trackProgress(failed().build());
    }
}

From source file:pt.webdetails.cpf.session.PentahoSession.java

@Override
public Object getParameter(String name) {
    if (name != null)
        return userSession.getAttribute(name.toString());
    return null;/* ww w  . j a v  a  2  s .c  o  m*/
}

From source file:br.unicamp.busfinder.ServerOperations.java

public static void Point2Point(GeoPoint touchedpoint, MapView map, final Context c, Calendar now) {

    // now.setTime(new Time(12, 40, 00)); // remove this
    String time = pad(now.getTime().getHours()) + ":" + pad(now.getTime().getMinutes()) + ":"
            + pad(now.getTime().getSeconds());
    // time = "";

    TouchOverlay.pathlist.clearPath(map);

    String req = String.format(
            BusFinderActivity.SERVER + "Point2Point?s_lat=%f;s_lon=%f;d_lat=%f;d_lon=%f;time=%s;limit=%d",
            (double) BusFinderActivity.myPoint.getLatitudeE6() / 1E6,
            (double) BusFinderActivity.myPoint.getLongitudeE6() / 1E6,
            (double) touchedpoint.getLatitudeE6() / 1e6, (double) touchedpoint.getLongitudeE6() / 1e6, time, 5);
    JSONArray path = getJSON(req);/* w  w  w .j  ava  2  s  .co  m*/
    if (path == null)
        Log.d("No response", "null");
    JSONObject obj = null;
    try {
        obj = path.getJSONObject(0);

        int source = Integer.parseInt(obj.getString("source"));
        int dest = Integer.parseInt(obj.getString("dest"));
        String departure = obj.getString("departure");
        String arrival = obj.getString("arrival");
        String circular = obj.getString("circular");
        int timeleft = obj.getInt("time");
        int distSource = obj.getInt("dist_source");
        int distDest = obj.getInt("dist_dest");
        String finalTime = obj.getString("final_time");
        String action = obj.getString("action").replaceAll("_", "");

        req = BusFinderActivity.SERVER + "getStopPosition?stopid=";

        JSONArray jar = getJSON(req + source);

        GeoPoint sourcePoint = geoFromJSON(jar.getJSONObject(0), "lat", "lon", "name");

        TouchOverlay.DrawPath(BusFinderActivity.myPoint, sourcePoint, Color.GREEN, map, true);

        String source_ = jar.getJSONObject(0).getString("name");
        if (source_ == null)
            source_ = "Point" + source;

        jar = getJSON(req + dest);

        GeoPoint destPoint = geoFromJSON(jar.getJSONObject(0), "lat", "lon", "name");

        TouchOverlay.DrawPath(destPoint, touchedpoint, Color.BLUE, map, false);

        /* EDIT HERE */
        String site = String.format(BusFinderActivity.SERVER + "getBusPath?line=%d&via=%d&start=%d&end=%d",
                (int) Integer.parseInt(obj.getString("line")), (int) Integer.parseInt(obj.getString("via")),
                (int) Integer.parseInt(obj.getString("source")), (int) Integer.parseInt(obj.getString("dest")));
        JSONArray sitePoints = getJSON(site);
        GeoPoint[] points = new GeoPoint[sitePoints.length()];
        for (int i = 0; i < sitePoints.length(); i++) {
            points[i] = ServerOperations.geoFromJSON(sitePoints.getJSONObject(i), "lat", "lon", "name");
        }
        TouchOverlay.DrawPathList(points, Color.RED, map, false);
        Log.d("xxx", "URL=" + site.toString());
        // get the kml (XML) doc. And parse it to get the coordinates(direction
        // route).
        /* END EDIT
        PathOverlay pO = new PathOverlay(sourcePoint, destPoint, 2,
              Color.RED);
        TouchOverlay.pathlist.addItem(pO, map);*/

        String dest_ = jar.getJSONObject(0).getString("name");
        if (dest_ == null)
            dest_ = "Point" + dest;

        Log.d("TOAST", "Take " + circular + " from " + source_ + " at " + departure + " and arrive at " + dest_
                + " at " + arrival + "----YOU HAVE " + timeleft + " seconds");

        BusFinderActivity.toast = Toast.makeText(c, "teste", Toast.LENGTH_SHORT);
        BusFinderActivity.toast.setGravity(Gravity.BOTTOM, 0, 0);
        //BusFinderActivity.toast.show();

        BusFinderActivity.timer = new CountDownTimer(timeleft * 1000, 1000) {

            public void onTick(long millisUntilFinished) {
                //BusFinderActivity.toast.setText("Bus Leaves\n in: "
                //   + millisUntilFinished / 1000 + " s");
                //BusFinderActivity.toast.show();
                BusFinderActivity.countdown.setText("Bus leaves in:" + millisUntilFinished / 1000 + " s");
            }

            public void onFinish() {
                BusFinderActivity.toast.setText("Times up!");
                BusFinderActivity.toast.show();
                BusFinderActivity.countdown.setText("0:00");
            }
        };

        BusFinderActivity.timer.start();

        BusFinderActivity.dialog = new AlertDialog.Builder(c).create();
        BusFinderActivity.dialog.setMessage(String.format(
                "%s to %s (%d m)" + "\n\n Take %s at %s" + "\n\n Arrive at %s at %s"
                        + "\n\n Go to your final destination (%d m) ~%s" + "",
                action, source + "_" + source_, distSource, circular, departure, dest + "_" + dest_, arrival,
                distDest, finalTime));

        BusFinderActivity.dialog.setCanceledOnTouchOutside(true);
        BusFinderActivity.dialog.show();
        BusFinderActivity.dialog.setTitle("Instructions");

        return;

    } catch (JSONException e) {
        e.printStackTrace();
    } catch (Exception e) {
        e.printStackTrace();
    }

    Toast.makeText(c, "Sorry No Path Found or Connection down...", Toast.LENGTH_LONG).show();

}

From source file:org.openmrs.module.adminui.page.controller.metadata.locations.LocationAttributeTypePageController.java

/**
 * Beautifies a fully qualified java class name
 *///ww w.j  a  va  2s.com
private String beautify(String input) {
    String classname = input.toString();
    classname = classname.substring(classname.lastIndexOf(".") + 1);
    String[] sections = StringUtils.splitByCharacterTypeCamelCase(classname);
    return StringUtils.join(sections, " ");
}