public String toClient(E value) { if (value == null) return null; return typeCoercer.coerce(value, String.class); }
public void run() { propertyAccess.clearCache(); typeCoercer.clearCache(); } };
public <S, T> T coerce(S input, Class<T> targetType) { return typeCoercer.coerce(input, targetType); }
public String toClient(Object value) { return typeCoercer.coerce(value, String.class); }
public String getLabel(Object value) { return coercer.coerce(value, String.class); }
public final <T> T coerce(Object value, Class<T> type) { return typeCoercer.coerce(value, type); }
public <T> T get(Class<T> desiredType, int index) { return typeCoercer.coerce(values[index], desiredType); }
private Object getObjectAsCorrectType(Object val) { if (val != null && boundType != null && !boundType.isAssignableFrom(val.getClass())) { return typeCoercer.coerce(val, boundType); } return val; }
@Override public String toClient(E value) { if (value == null) return null; Object id = propertyAdapter.get(value); if (id == null) { return null; } return typeCoercer.coerce(id, String.class); }
@Override public String toClient(E value) { if (value == null) return null; Object id = propertyAdapter.get(value); if (id == null) { return null; } return typeCoercer.coerce(id, String.class); }
@Override public <S, T> T coerce(S input, Class<T> targetType) { if (targetType.isInstance(input)) return targetType.cast(input); return delegate().coerce(input, targetType); }
@Override public <T> T get(Class<T> desiredType, int index) { if (index == 0) { return coercer.coerce(input, desiredType); } return context.get(desiredType, index-1); } };
public E toValue(String clientValue) { if (InternalUtils.isBlank(clientValue)) return null; return typeCoercer.coerce(clientValue, enumType); }
public boolean handleResult(Object result) { List matches = coercer.coerce(result, List.class); matchesHolder.put(matches); return true; } };
private RenderCommand toRenderer(String zoneId, Object provided) { try { return typeCoercer.coerce(provided, RenderCommand.class); } catch (Exception ex) { throw new IllegalArgumentException(String.format("Failure converting renderer for zone '%s': %s", zoneId, ExceptionUtils.toMessage(ex)), ex); } } }
@Override public <S, T> T coerce(S input, Class<T> targetType) { if (targetType.isInstance(input)) return targetType.cast(input); return delegate().coerce(input, targetType); }
@Override public <T> T get(Class<T> desiredType, int index) { if (index == 0) { return typeCoercer.coerce(newValue, desiredType); } return context.get(desiredType, index-1); } };
@SuppressWarnings("unchecked") public Object defaultValueForType(String className) { Class clazz = forName(className); if (!clazz.isPrimitive()) return null; // Remembering that 0 coerces to boolean false, this covers all the primitive // types (boolean, int, short, etc.) return typeCoercer.coerce(0, clazz); }
private RenderCommand toRenderCommand(Object object) { RenderCommand renderCommand = null; if (object instanceof RenderCommand) { renderCommand = (RenderCommand) object; } else { try { renderCommand = typeCoercer.coerce(object, RenderCommand.class); } catch (RuntimeException e) { throw new IllegalArgumentException( String.format("Couldn't find a coercion from %s to RenderCommand", object.getClass().getName()), e); } } return renderCommand; }
public boolean handleResult(Object result) { holder.put(typeCoercer.coerce(result, Object[].class)); // We've got the value, stop the event. return true; } };