Example usage for java.util Objects toString

List of usage examples for java.util Objects toString

Introduction

In this page you can find the example usage for java.util Objects toString.

Prototype

public static String toString(Object o) 

Source Link

Document

Returns the result of calling toString for a non- null argument and "null" for a null argument.

Usage

From source file:com.joyent.manta.client.multipart.MantaMultipartUploadTuple.java

/**
 * Creates a new instance based on the passed parameters.
 *
 * @param partNumber Non-zero positive integer representing the relative
 *                   position of the part in relation to the other parts for the multipart upload.
 * @param etag HTTP Etag value returned by Manta for the multipart upload part
 *//*w  ww.  j  a  v  a 2 s.  c  o m*/
public MantaMultipartUploadTuple(final int partNumber, final Object etag) {
    this(partNumber, Objects.toString(etag));
}

From source file:org.jamocha.Jamocha.java

public Pair<Queue<Warning>, String> parse() throws ParseException {
    final SFPStart n = this.parser.Start();
    if (null == n)
        return null;
    final String value = Objects.toString(n.jjtAccept(this.visitor, null));
    return Pair.of(this.visitor.getWarnings(), value);
}

From source file:com.github.lothar.security.acl.compound.AclComposersRegistry.java

@Override
public String toString() {
    return Objects.toString(composers);
}

From source file:net.modelbased.proasense.storage.writer.RandomEventGenerator.java

public DerivedEvent generateDerivedEvent(String componentId) {
    // Define complex value
    ComplexValue value = new ComplexValue();
    value.setValue(Objects.toString(randomNumber.nextLong()));
    value.setType(VariableType.LONG);/* w ww.  j a  v a 2 s. c  o  m*/

    // Define properties
    Map<String, ComplexValue> properties = new HashMap<String, ComplexValue>();
    properties.put("value", value);

    // Define derived event
    DerivedEvent event = new DerivedEvent();
    event.setTimestamp(System.currentTimeMillis());
    event.setComponentId(componentId);
    event.setEventName(randomData.nextHexString(10));
    event.setEventProperties(properties);

    return event;
}

From source file:com.github.lothar.security.acl.SimpleAclStrategy.java

@Override
public String toString() {
    return name() + ":" + Objects.toString(handlersByFeature);
}

From source file:com.kopaid.example.wildfly.spring.security.UserDetailsServiceImpl.java

@Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
    if (!users.containsKey(username)) {
        LOG.log(Level.INFO, "user with username '{0}' not found", username);
        throw new UsernameNotFoundException(Objects.toString(username) + "not found");
    }/*  w  w w .j  a  v  a2  s.  c  om*/
    LOG.log(Level.INFO, "user with username '{0}' found", username);
    return users.get(username);
}

From source file:org.nuxeo.client.api.objects.upload.BatchUpload.java

public BatchUpload upload(String name, long length, String fileType, String batchId, String fileIdx,
        File file) {//  w  ww .  j a  va  2  s. c o m
    if (chunkSize == 0) {
        // Post file
        RequestBody fbody = RequestBody.create(MediaType.parse(fileType), file);
        return (BatchUpload) getResponse(name, Objects.toString(length), fileType,
                ConstantsV1.UPLOAD_NORMAL_TYPE, "0", "1", batchId, fileIdx, fbody);
    }
    Object response = null;
    int contentLength = 0;
    byte[] buffer = new byte[chunkSize];
    int chunkIndex = 0;
    long chunkCount = (file.length() + chunkSize - 1) / chunkSize;
    try (BufferedInputStream bis = new BufferedInputStream(new FileInputStream(file))) {
        while ((contentLength = bis.read(buffer)) > 0) {
            // Post chunk as a stream
            RequestBody requestBody = RequestBody.create(MediaType.parse(ConstantsV1.APPLICATION_OCTET_STREAM),
                    buffer, 0, contentLength);
            response = getResponse(name, Objects.toString(length), fileType, ConstantsV1.UPLOAD_CHUNKED_TYPE,
                    Objects.toString(chunkIndex), Objects.toString(chunkCount), batchId, fileIdx, requestBody);
            chunkIndex++;
        }
        return (BatchUpload) response;
    } catch (IOException reason) {
        throw new NuxeoClientException(reason);
    }
}

From source file:jp.furplag.spring.booster.validation.tuple.PairNumbers.java

/**
 *
 *
 * @param o the object to try parsing to a number.
 * @param classes {@code Class<? extends Number>[]}.
 * @return returns true if specified classes contains the parsed number class.
 *///from  ww w  . jav a2s .  com
private static boolean isNumberOf(Object o, Class<?>... classes) {
    // @formatter:off
    return isCollectable(o)
            ? ObjectUtils.isAny(NumberUtils.createNumber(Objects.toString(o)).getClass(), classes)
            : false;
    // @formatter:on
}

From source file:org.terasoluna.gfw.functionaltest.app.el.ElSimpleJavaBeanDefaultTrimController.java

@RequestMapping(value = "6_15/search", method = RequestMethod.GET)
public String nestedJavaBeanQueryString(UserForm userForm, @PageableDefault Pageable pageable, Model model) {

    // Create Dummy Data
    List<String> dummyList = new ArrayList<String>();
    for (int i = 1; i <= 10; i++) {
        dummyList.add("Dummy");
    }//from  w  w w  .ja  v a  2  s. co  m

    Page<String> dummyPage = new PageImpl<String>(dummyList, pageable, 100);
    model.addAttribute("page", dummyPage);

    String nameString = Objects.toString(userForm.getName());
    String ageString = Objects.toString(userForm.getAge());

    model.addAttribute("nameString", nameString);
    model.addAttribute("ageString", ageString);

    String nameStringItem = Objects.toString(userForm.getItem().getName());
    String ageStringItem = Objects.toString(userForm.getItem().getAge());

    model.addAttribute("nameStringItem", nameStringItem);
    model.addAttribute("ageStringItem", ageStringItem);

    return "el/simpleJavaBeanDefaultTrimQueryOutput";
}

From source file:io.tsdb.opentsdb.realtime.RollupPublisher.java

public Deferred<Object> publishDataPoint(final String metric, final long timestamp, final long value,
        final Map<String, String> tags, final byte[] tsuid) {
    LOG.trace("Storing Datapoint: " + metric + " " + timestamp + " " + value);
    IncomingDataPoint dp = makeDatapoint(metric + "." + Objects.toString(this.minutes) + "m-avg", timestamp,
            value, tags);// w w w  .  ja  v  a2 s . c  o m
    storeDatapoint(dp);
    return new Deferred<Object>();
}