@Override public Map<String, Object> toMap() { Map<String,Object> props = Beans.toMap(raw); if(null != map) { props.putAll(map); } return props; } }
public Map<String, String> hencode(Object o) { Map<String, Object> map = Beans.toMap(o); Map<String, String> hash = new LinkedHashMap<>(map.size()); map.forEach((k,v) -> { hash.put(k, encode(v)); }); return hash; }
@SuppressWarnings({ "unchecked", "rawtypes" }) public Map<String, Object> toMap(Object object) throws InvalidParametersException { if(null == object){ throw new InvalidParameterException("Cannot convert null to map"); } if(object instanceof Map){ return ((Map)object); }else if(object instanceof Params){ return ((Params)object).map(); } if(Beans.isSimpleProperty(object.getClass())){ throw new InvalidParameterException("Cannot convert value of simple type '" + object.getClass().getName() + "' to map"); } return Beans.toMap(object); }
public int update(Object record, Object id) { if(null == id) { return dao.update(em, record); }else { return dao.update(em, id, Beans.toMap(record)); } }
@Override public int executeNamedUpdate(String sqlKey, Object bean) { return ensureGetSqlCommand(sqlKey).executeUpdate(simpleSqlContext, Beans.toMap(bean)); }
public static Object[] getIdArgs(EntityMapping em, Object id) { if(id instanceof Object[]) { return (Object[])id; } if(id instanceof Collection) { return ((Collection)id).toArray(); } if(em.getKeyColumnNames().length > 1) { Map map; if(id instanceof Map) { map = (Map)id; }else { map = Beans.toMap(id); } List<Object> args = new ArrayList<>(); for(String name : em.getKeyFieldNames()) { args.add(map.get(name)); } return args.toArray(); }else { return new Object[]{id}; } }
public static String getIdPath(EntityMapping em, Object id) { if(em.getKeyFieldNames().length == 1) { return "/" + id; }else if(id instanceof Map){ return getIdPath(em, (Map)id); }else { return getIdPath(em, Beans.toMap(id)); } }
@Override protected int processParameter(Object param, Options options, int index, int size, boolean isOmitMeta) { if(param instanceof Map){ return processMap((Map)param, options, index, size, isOmitMeta); } try { return super.processParameter(param, options, index, size, isOmitMeta); }catch (MustacheException e) { return processMap(Beans.toMap(param), options, index, size, isOmitMeta); } }
@Override protected boolean doValidate(Validation validation, String name, Object value, Out<Object> out) { boolean isMap = value instanceof Map; Map map = isMap ? (Map)value : Beans.toMap(value);
properties = (Map)request; }else{ properties = Beans.toMap(request);