List of usage examples for org.apache.commons.lang ObjectUtils toString
public static String toString(Object obj, String nullStr)
Gets the toString
of an Object
returning a specified text if null
input.
ObjectUtils.toString(null, null) = null ObjectUtils.toString(null, "null") = "null" ObjectUtils.toString("", "null") = "" ObjectUtils.toString("bat", "null") = "bat" ObjectUtils.toString(Boolean.TRUE, "null") = "true"
From source file:org.amplafi.flow.impl.DefaultFlowValuesMap.java
/** * @see java.util.Map#put(java.lang.Object, java.lang.Object) *///from w w w.jav a 2s . c om @Override public String put(FlowValueMapKey key, String value) { return this.map.put(toKey(null, key), ObjectUtils.toString(value, null)); }
From source file:org.amplafi.flow.impl.DefaultFlowValuesMap.java
public String putAny(Object key, Object value) { return this.map.put(toKey(null, key), ObjectUtils.toString(value, null)); }
From source file:org.amplafi.flow.impl.DefaultFlowValuesMapKey.java
public DefaultFlowValuesMapKey(Object namespace, Object key) { String space = ObjectUtils.toString(namespace, null); setNamespace(space);/* w w w.j ava 2s .c o m*/ this.key = ObjectUtils.toString(key, null); }
From source file:org.amplafi.flow.impl.FlowStateImpl.java
@Override public String getRawProperty(String namespace, String key) { return ObjectUtils.toString(getFlowValuesMap().get(namespace, key), null); }
From source file:org.amplafi.flow.impl.TransitionFlowActivity.java
public String getFinishKey() { return finishKey != null ? finishKey : ObjectUtils.toString(this.getTransitionType(), null); }
From source file:org.amplafi.flow.translator.CharSequenceFlowTranslator.java
@Override @SuppressWarnings({ "unchecked" }) public T deserialize(FlowPropertyProvider flowPropertyProvider, FlowPropertyDefinition flowPropertyDefinition, DataClassDefinition dataClassDefinition, Object serializedObject) { return (T) JSONObject.unquote(ObjectUtils.toString(serializedObject, null)); }
From source file:org.amplafi.flow.translator.FlowCollectionTranslator.java
@SuppressWarnings("unchecked") protected void deserialize(FlowPropertyProvider flowPropertyProvider, FlowPropertyDefinition flowPropertyDefinition, DataClassDefinition dataClassDefinition, Collection<T> collection, Object serialized) { JSONArray jsonArray;/*from ww w . j ava2s . c om*/ if (serialized instanceof JSONArray) { jsonArray = (JSONArray) serialized; } else { jsonArray = new JSONArray(ObjectUtils.toString(serialized, null)); } for (Object o : jsonArray.asList()) { T element = (T) dataClassDefinition.getElementDataClassDefinition().deserialize(flowPropertyProvider, flowPropertyDefinition, o); collection.add(element); } }
From source file:org.amplafi.flow.validation.FlowValidationException.java
public static void valid(FlowState flowState, boolean failIfFalse, Object property, Object... messages) throws FlowValidationException { if (!failIfFalse) { Object[] actual = new Object[] { ObjectUtils.toString(property, ""), StringUtils.join(messages) }; FlowValidationResult flowValidationResult = new ReportAllValidationResult( new MissingRequiredTracking(actual)); throw new FlowValidationException(flowState, flowValidationResult); }/*from w w w . j ava 2 s .co m*/ }
From source file:org.amplafi.flow.web.components.FlowEntryPoint.java
@SuppressWarnings("unchecked") protected List<String> getConvertedValues(Object initialValues) { List<String> values = null; if (initialValues != null) { values = new ArrayList<String>(); if (initialValues instanceof Iterable) { for (String s : (Iterable<String>) initialValues) { values.add(s);/*from w ww . j ava 2s .co m*/ } } else if (initialValues instanceof Map) { for (Map.Entry<Object, Object> entry : ((Map<Object, Object>) initialValues).entrySet()) { String key = ObjectUtils.toString(entry.getKey(), null); String value = ObjectUtils.toString(entry.getValue(), null); FlowUtils.INSTANCE.addInitialValues(values, key, value); } } else { values.add(initialValues.toString()); } } return values; }
From source file:org.amplafi.json.JSONObject.java
public static JSONObject toJsonObject(Object object) { if (object instanceof JSONObject) { return (JSONObject) object; } else {/*ww w .jav a 2s.c o m*/ return new JSONObject(ObjectUtils.toString(object, "{}")); } }