Java Code Examples for java.util.Arrays#deepToString()

The following examples show how to use java.util.Arrays#deepToString() .
Example 1
Project: JTelegramBot   File: Message.java    License: MIT License 6 votes vote down vote up
@Override
public String toString()
{
	return "Message{" + "messageId=" + messageId + ", from=" + from + ", date=" + date + ", chat=" + chat +
			", forwardFrom=" + forwardFrom + ", forwardFromChat=" + forwardFromChat + ", forwardDate=" +
			forwardDate + ", replyToMessage=" + replyToMessage + ", editDate=" + editDate + ", text='" +
			text + '\'' + ", entities=" + Arrays.deepToString(entities) + ", audio=" + audio + ", document=" +
			document + ", photo=" + Arrays.deepToString(photo) + ", sticker=" + sticker + ", video=" + video +
			", voice=" + voice + ", caption='" + caption + '\'' + ", contact=" + contact + ", location=" +
			location + ", venue=" + venue + ", newChatMember=" + newChatMember + ", leftChatMember=" +
			leftChatMember + ", newChatTitle='" + newChatTitle + '\'' + ", newChatPhoto=" +
			Arrays.deepToString(newChatPhoto) + ", deleteChatPhoto=" + deleteChatPhoto + ", groupChatCreated=" +
			groupChatCreated + ", superGroupChatCreated=" + superGroupChatCreated + ", channelChatCreated=" +
			channelChatCreated + ", migrateToChatId=" + migrateToChatId + ", migrateFromChatId=" +
			migrateFromChatId + ", pinnedMessage=" + pinnedMessage + '}';
}
 
Example 2
Project: jdk8u-jdk   File: ImmutableDescriptor.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
public String toString() {
    StringBuilder sb = new StringBuilder("{");
    for (int i = 0; i < names.length; i++) {
        if (i > 0)
            sb.append(", ");
        sb.append(names[i]).append("=");
        Object v = values[i];
        if (v != null && v.getClass().isArray()) {
            String s = Arrays.deepToString(new Object[] {v});
            s = s.substring(1, s.length() - 1); // remove [...]
            v = s;
        }
        sb.append(String.valueOf(v));
    }
    return sb.append("}").toString();
}
 
Example 3
Project: openjdk-jdk8u-backup   File: ImmutableDescriptor.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
public String toString() {
    StringBuilder sb = new StringBuilder("{");
    for (int i = 0; i < names.length; i++) {
        if (i > 0)
            sb.append(", ");
        sb.append(names[i]).append("=");
        Object v = values[i];
        if (v != null && v.getClass().isArray()) {
            String s = Arrays.deepToString(new Object[] {v});
            s = s.substring(1, s.length() - 1); // remove [...]
            v = s;
        }
        sb.append(String.valueOf(v));
    }
    return sb.append("}").toString();
}
 
Example 4
Project: jdk8u_jdk   File: ImmutableDescriptor.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
public String toString() {
    StringBuilder sb = new StringBuilder("{");
    for (int i = 0; i < names.length; i++) {
        if (i > 0)
            sb.append(", ");
        sb.append(names[i]).append("=");
        Object v = values[i];
        if (v != null && v.getClass().isArray()) {
            String s = Arrays.deepToString(new Object[] {v});
            s = s.substring(1, s.length() - 1); // remove [...]
            v = s;
        }
        sb.append(String.valueOf(v));
    }
    return sb.append("}").toString();
}
 
Example 5
Project: jdk8u-jdk   File: ImmutableDescriptor.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
public String toString() {
    StringBuilder sb = new StringBuilder("{");
    for (int i = 0; i < names.length; i++) {
        if (i > 0)
            sb.append(", ");
        sb.append(names[i]).append("=");
        Object v = values[i];
        if (v != null && v.getClass().isArray()) {
            String s = Arrays.deepToString(new Object[] {v});
            s = s.substring(1, s.length() - 1); // remove [...]
            v = s;
        }
        sb.append(String.valueOf(v));
    }
    return sb.append("}").toString();
}
 
Example 6
Project: tasmo   File: Expectations.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public String toString() {
    return "Expectation{"
            + "testCase=" + testCase
            + ", viewId=" + viewId
            + ", viewClassName=" + viewClassName
            + ", modelPathId=" + modelPathIdHashcode
            + ", path=" + path
            + ", modelPathInstanceIds=" + Arrays.deepToString(modelPathInstanceIds)
            + ", fieldName=" + fieldName
            + ", value=" + value
            + '}';
}
 
Example 7
Project: w2j-cli   File: ArrayUtil.java    License: MIT License 5 votes vote down vote up
/**
 * 数组或集合转String
 *
 * @param obj 集合或数组对象
 * @return 数组字符串,与集合转字符串格式相同
 */
public static String toString(Object obj){
	if (null == obj) {
		return null;
	}
	if (ArrayUtil.isArray(obj)) {
		try {
			return Arrays.deepToString((Object[]) obj);
		} catch (Exception e) {
			final String className = obj.getClass().getComponentType().getName();
			if ("long".equals(className)) {
				return Arrays.toString((long[]) obj);
			} else if ("int".equals(className)) {
				return Arrays.toString((int[]) obj);
			} else if ("short".equals(className)) {
				return Arrays.toString((short[]) obj);
			} else if ("char".equals(className)) {
				return Arrays.toString((char[]) obj);
			} else if ("byte".equals(className)) {
				return Arrays.toString((byte[]) obj);
			} else if ("boolean".equals(className)) {
				return Arrays.toString((boolean[]) obj);
			} else if ("float".equals(className)) {
				return Arrays.toString((float[]) obj);
			} else if ("double".equals(className)) {
				return Arrays.toString((double[]) obj);
			} else {
				throw new RuntimeException(e);
			}
		}
	}
	return obj.toString();
}
 
Example 8
Project: openjdk-8   File: CompositeDataSupport.java    License: GNU General Public License v2.0 5 votes vote down vote up
private String contentString() {
    StringBuilder sb = new StringBuilder("{");
    String sep = "";
    for (Map.Entry<String, Object> entry : contents.entrySet()) {
        sb.append(sep).append(entry.getKey()).append("=");
        String s = Arrays.deepToString(new Object[] {entry.getValue()});
        sb.append(s.substring(1, s.length() - 1));
        sep = ", ";
    }
    sb.append("}");
    return sb.toString();
}
 
Example 9
Project: codebuff   File: MoreObjects.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * Returns a string in the format specified by {@link MoreObjects#toStringHelper(Object)}.
 *
 * <p>After calling this method, you can keep adding more properties to later call toString()
 * again and get a more complete representation of the same object; but properties cannot be
 * removed, so this only allows limited reuse of the helper instance. The helper allows
 * duplication of properties (multiple name/value pairs with the same name can be added).
 */

@Override
public String toString() {
  // create a copy to keep it consistent in case value changes
    boolean omitNullValuesSnapshot = omitNullValues;
    String nextSeparator = "";
    StringBuilder builder = new StringBuilder(32).append(className).append('{');
    for (ValueHolder valueHolder = holderHead.next; valueHolder != null; valueHolder = valueHolder.next) {
    Object value = valueHolder.value;
    if (!omitNullValuesSnapshot || value != null) {
        builder.append(nextSeparator);
        nextSeparator = ", ";
        if (valueHolder.name != null) {
        builder.append(valueHolder.name).append('=');
        }
        if (value != null && value.getClass().isArray()) {
                                                                                                             Object[] objectArray = {value};
                                                                                                             String arrayString = Arrays.deepToString(objectArray);
                                                                                                             builder.append(arrayString, 1, arrayString.length() - 1);
        } else {
          builder.append(value);
        }
    }
    }
    return builder.append('}').toString();
}
 
Example 10
Project: ignite   File: VariationsIterator.java    License: Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override public int[] next() {
    // Only first call.
    if (position == -1) {
        position = 0;

        cntOfVectors++;

        return arraycopy(vector);
    }

    if (!updateVector(vector, position)) {
        if (position + 1 == params.length)
            throw new IllegalStateException("[position=" + position + ", vector=" +
                Arrays.toString(vector) + ", params=" + Arrays.deepToString(params));

        position++;

        // Skip params with length 1. We cannot set 1 at this position.
        while (position < params.length && params[position].length < 2)
            position++;

        if (position == params.length)
            throw new IllegalStateException("[position=" + position + ", vector=" +
                Arrays.toString(vector) + ", params=" + Arrays.deepToString(params));

        vector[position] = 1;

        cntOfVectors++;

        return arraycopy(vector);
    }

    cntOfVectors++;

    return arraycopy(vector);
}
 
Example 11
Project: gemfirexd-oss   File: SortedMap2IndexScanController.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public String toString() {

  if (SanityManager.DEBUG) {
    String string = "\nSortedMap2IndexScanController\tskiplist-congid = "
        + (this.baseContainer != null ? this.baseContainer.getId() : -1)

        /* "\n\trh:" + scan_position.current_rh + */
        + "\n\tinit_scanColumnList = "
        + init_scanColumnList
        + "\n\tinit_scanColumnList.size() = "
        + ((init_scanColumnList != null) ? init_scanColumnList.size() : 0)
        +

        "\n\tinit_startKeyValue = "
        + RowUtil.toString(init_startKeyValue)
        + "\n\tinit_startSearchOperator = "
        + ((init_startSearchOperator == ScanController.GE) ? "GE"
            : ((init_startSearchOperator == ScanController.GT) ? "GT"
                : Integer.toString(init_startSearchOperator)))
        + "\n\tinit_qualifier[]         = "
        + Arrays.deepToString(init_qualifier)
        + "\n\tinit_stopKeyValue = "
        + RowUtil.toString(init_stopKeyValue)
        + "\n\tinit_stopSearchOperator = "
        + ((init_stopSearchOperator == ScanController.GE) ? "GE"
            : ((init_stopSearchOperator == ScanController.GT) ? "GT"
                : Integer.toString(init_stopSearchOperator)));

    return (string);
  }
  else {
    return null;
  }
}
 
Example 12
Project: logger   File: Utils.java    License: Apache License 2.0 5 votes vote down vote up
public static String toString(Object object) {
  if (object == null) {
    return "null";
  }
  if (!object.getClass().isArray()) {
    return object.toString();
  }
  if (object instanceof boolean[]) {
    return Arrays.toString((boolean[]) object);
  }
  if (object instanceof byte[]) {
    return Arrays.toString((byte[]) object);
  }
  if (object instanceof char[]) {
    return Arrays.toString((char[]) object);
  }
  if (object instanceof short[]) {
    return Arrays.toString((short[]) object);
  }
  if (object instanceof int[]) {
    return Arrays.toString((int[]) object);
  }
  if (object instanceof long[]) {
    return Arrays.toString((long[]) object);
  }
  if (object instanceof float[]) {
    return Arrays.toString((float[]) object);
  }
  if (object instanceof double[]) {
    return Arrays.toString((double[]) object);
  }
  if (object instanceof Object[]) {
    return Arrays.deepToString((Object[]) object);
  }
  return "Couldn't find a correct type for the object";
}
 
Example 13
Project: hibernate-types   File: AbstractArrayTypeDescriptor.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public String toString(Object value) {
    return Arrays.deepToString(ArrayUtil.wrapArray(value));
}
 
Example 14
Project: headlong   File: Tuple.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public String toString() {
    return Arrays.deepToString(elements);
}
 
Example 15
Project: siddhi   File: StdDevAttributeAggregatorExecutor.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Object processAdd(Object[] data, AggregatorState state) {
    return new IllegalStateException("stdDev cannot process data array, but found " + Arrays.deepToString(data));
}
 
Example 16
Project: a   File: ConvertUtils.java    License: GNU General Public License v3.0 4 votes vote down vote up
public static String toString(Object[] objects) {
    return Arrays.deepToString(objects);
}
 
Example 17
Project: flink   File: EncodingUtils.java    License: Apache License 2.0 4 votes vote down vote up
public static String objectToString(Object object) {
	final String arrayString = Arrays.deepToString(new Object[]{object});
	return arrayString.substring(1, arrayString.length() - 1);
}
 
Example 18
Project: livingdoc-core   File: EqualExpectation.java    License: GNU General Public License v3.0 4 votes vote down vote up
@Override
public String toString() {
    return isArray(matchee) ? Arrays.deepToString(( Object[] ) matchee) : matchee.toString();
}
 
Example 19
Project: siddhi   File: SumAttributeAggregatorExecutor.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Object processRemove(Object[] data, AggregatorState state) {
    // will not occur
    return new IllegalStateException("Sin cannot process data array, but found " + Arrays.deepToString(data));
}
 
Example 20
Project: pcgen   File: CDOMTypeRef.java    License: GNU Lesser General Public License v2.1 3 votes vote down vote up
/**
 * Constructs a new CDOMTypeRef for the given Class to be represented by
 * this CDOMTypeRef and the given types.
 * 
 * @param objClass
 *            The Class of the underlying objects contained by this
 *            reference.
 * @param typeArray
 *            An array of the Types of objects this CDOMTypeRef contains.
 */
public CDOMTypeRef(ClassIdentity<T> objClass, String[] typeArray)
{
	super(objClass.getReferenceDescription() + " " + Arrays.deepToString(typeArray));
	types = Arrays.copyOf(typeArray, typeArray.length);
	identity = objClass;
}