Generate the string key for an object.

@param object the object which is part of the global key

@return the unique string for this object
14226
private String buildObjectKey(final Object object) {

        String objectKey = null;
        final Class<?> objectClass = object.getClass();

        final KeyGenerator typeGenerator = objectClass.getAnnotation(KeyGenerator.class);
        if (typeGenerator == null) {
            objectKey = generateAggregatedKey(object);
        } else {
            objectKey = generateTypeKey(object, typeGenerator);
        }

        // If no Type keyGenerator neither Method Generator were used, use the default toString method
        if (objectKey == null) {
            objectKey = object.toString();
        }

        return objectKey;
    }
585120
@Override
	public String asString(Object object) {
		// at this point object is guaranteed to be a File
		return Files.path2unix(((File) object).getPath());
	}
1239893
@Override
	public String asString(Object object) {
		assert object != null;
		assert object instanceof Class;
		return ((Class<?>) object).getCanonicalName();
	}
80305
private static Object copy(Object object) {
        if (object instanceof byte[]) {
            byte[] data = (byte[]) object;
            return Arrays.copyOf(data, data.length);
        }
        return object;
    }

    /**
     * Makes a deep copy of a {@link Map}. Immutable objects in the map will be shared (e.g., integers, strings,
     * immutable messages) and mutable ones will have a copy (e.g., byte arrays, mutable messages).
     *
     * @param <K> the key type
     * @param <V> the value type
     * @param map the map
     * @return the map
     */
    @SuppressWarnings("unchecked")
    static <K, V> Map<K, V> copy(Map<K, V> map) {
        Map<K, V> result = new LinkedHashMap<K, V>();
        for (Map.Entry<K, V> entry : map.entrySet()) {
            result.put(entry.getKey(), (V) copy(entry.getValue()));
        }
862651
public VisDialog key (final int keycode, final Object object) {
		addListener(new InputListener() {
			@Override
			public boolean keyDown (InputEvent event, int keycode2) {
				if (keycode == keycode2) {
					result(object);
					if (!cancelHide) hide();
					cancelHide = false;
				}
				return false;
			}
		});
		return this;
	}
264505
public <T> String marshal(final T object) {

        if (object == null) {
            throw new IllegalArgumentException("object parameter is null");
        }

        ObjectWriter writer = objectMapper.writer().withDefaultPrettyPrinter();
        String results = null;
        try {
            results = writer.writeValueAsString(object);
        } catch (JsonGenerationException e) {
            System.err.println("JsonGenerationException, message=" + e.getMessage());
        } catch (JsonMappingException e) {
            e.printStackTrace();
            System.err.println("JsonMappingException, message=" + e.getMessage());
        } catch (IOException e) {
            System.err.println("IOException, message=" + e.getMessage());
        }

        return (results);
    }
1295334
public static String findUniqueKey(JSONArray expected) throws JSONException {
        // Find a unique key for the object (id, name, whatever)
        JSONObject o = (JSONObject) expected.get(0); // There's at least one at this point
        for (String candidate : getKeys(o)) {
            if (isUsableAsUniqueKey(candidate, expected)) return candidate;
        }
        // No usable unique key :-(
        return null;
    }
99666
public static String stringify(ObjectMapper mapper, Object object) {
        try {
            return mapper.writeValueAsString(object);
        } catch (JsonProcessingException e) {
            throw new IllegalArgumentException(e);
        }
    }
445904
public static StringBuffer startToString(final Object object) {

        StringBuffer buffer = new StringBuffer("[");
        buffer.append(object.getClass().getName());
        buffer.append("@");
        buffer.append(Integer.toHexString(System.identityHashCode(object)));
        return buffer;

    }
1209524
public static String identityToString(Object pObject) {
        if (pObject == null) {
            return null;
        }
        else {
            return pObject.getClass().getName() + '@' + Integer.toHexString(System.identityHashCode(pObject));
        }
    }
121654
public String serialize(Object object) {
		XStream xstream = new XStream();
		return xstream.toXML(object);
	}
568177
@Override
  public String asString(Object object)
  {
    // at this point object is guaranteed to be enumeration
    Enum<?> e = (Enum<?>)object;
    if(object instanceof OrdinalEnum) {
      return Integer.toString(e.ordinal());
    }
    return e.name();
  }
239825
@Override
  public Object get(Object obj) {
    String key = this.keyOf(obj);
    return this.getByKey(key);
  }
426544
public String getAsString(String key) {
		Object obj = this.get(key);
		if (obj == null)
			return null;
		return obj.toString();
	}
1152718
public ObjectIdSerializer<?> getObjectId( Object object ) {
        if ( null != mapObjectId ) {
            return mapObjectId.get( object );
        }
        return null;
    }
110580
public static String format(Object object) {
        Gson gson = new GsonBuilder().setPrettyPrinting().disableHtmlEscaping().create();
        JsonParser jp = new JsonParser();
        JsonElement je = jp.parse(gson.toJson(object));
        String prettyJsonString = gson.toJson(je);
        //简单处理function
        String[] lines = prettyJsonString.split("\n");
        lines = replaceFunctionQuote(lines);
        StringBuilder stringBuilder = new StringBuilder();
        for (String line : lines) {
            stringBuilder.append(line);
        }
        return stringBuilder.toString();
    }
355653
public static <K, V> Set<K> keys(final Map<K, V> object) {
        return object.keySet();
    }