Beispiel #1
0
 /**
  * Converts the specified object to its string representation. If the object
  * is null return the string {@code "null"}, otherwise use {@code
  * toString()} to get the string representation.
  *
  * @param value
  *            the object.
  * @return the object converted to a string, or the string {@code "null"}.
  */
 public static String valueOf(Object value)
 {
     return value != null ? value.toString() : "null"; //$NON-NLS-1$
 }
Beispiel #2
0
 /**
  * Inserts the string representation of the specified {@code Object} at the
  * specified {@code offset}. The {@code Object} value is converted to a
  * String according to the rule defined by {@link String#valueOf(Object)}.
  *
  * @param offset
  *            the index to insert at.
  * @param obj
  *            the {@code Object} to insert.
  * @return this builder.
  * @throws StringIndexOutOfBoundsException
  *             if {@code offset} is negative or greater than the current
  *             {@code length()}.
  * @see String#valueOf(Object)
  */
 public StringBuilder insert(int offset, Object obj)
 {
     insert0(offset, obj == null ? "null" : obj.toString()); //$NON-NLS-1$
     return this;
 }
Beispiel #3
0
 /**
  * Appends the string representation of the specified {@code Object}.
  * The {@code Object} value is converted to a string according to the rule
  * defined by {@link String#valueOf(Object)}.
  *
  * @param obj
  *            the {@code Object} to append.
  * @return this builder.
  * @see String#valueOf(Object)
  */
 public StringBuilder append(Object obj)
 {
     if (obj == null) {
         appendNull();
     } else {
         append0(obj.toString());
     }
     return this;
 }
Beispiel #4
0
 /**
  * Adds the string representation of the specified object to the end of this
  * StringBuffer.
  * <p />
  * If the specified object is {@code null} the string {@code "null"} is
  * appended, otherwise the objects {@code toString} is used to get its
  * string representation.
  *
  * @param obj
  *            the object to append (may be null).
  * @return this StringBuffer.
  * @see String#valueOf(Object)
  */
 public java.lang.StringBuffer append(Object obj)
 {
     lock (this) {
         if (obj == null) {
             appendNull();
         } else {
             append0(obj.toString());
         }
         return this;
     }
 }
 //-----------------------------------------------------------------------
 /**
  * Overrides convertKey() from {@link AbstractHashedMap} to convert keys to
  * lower case.
  * <p>
  * Returns null if key is null.
  *
  * @param key  the key convert
  * @return the converted key
  */
 protected override Object convertKey(Object key)
 {
     if (key != null)
     {
         return key.toString().ToLower();
     }
     else
     {
         return AbstractHashedMap.NULL;
     }
 }
 protected static void checkNotNullAndLog(String argName, Object value) {
   Preconditions.checkArgument(value != null && !value.toString().isEmpty(),
     argName + " is null or empty");
   log.debug("{}: {}", argName, value);
 }