@Override public ValueStore getValueStore(Object storageObject, int dataIndex) throws UnifyException { if (storageObject != null) { if (storageObject instanceof PackableDoc) { return new PackableDocStore((PackableDoc) storageObject, dataIndex); } if (storageObject instanceof MapValues) { return new MapValuesStore((MapValues) storageObject, dataIndex); } return new BeanValueStore(storageObject, dataIndex); } return null; }
@Override public ValueStore getArrayValueStore(Object[] storageObject, int dataIndex) throws UnifyException { if (storageObject != null) { if (storageObject instanceof PackableDoc[]) { return new PackableDocArrayStore((PackableDoc[]) storageObject, dataIndex); } if (storageObject instanceof MapValues[]) { return new MapValuesArrayStore((MapValues[]) storageObject, dataIndex); } return new BeanValueArrayStore(storageObject, dataIndex); } return null; }
public void writeFieldValue(PackableDocRWConfig rwConfig, String name, Object value) throws UnifyException { FieldConfig fc = config.getFieldConfig(name); if (!fc.isComplex()) { throw new UnifyException(UnifyCoreErrorConstants.DOCUMENT_FIELD_NOT_COMPLEX, name); } FieldMapping fMapping = rwConfig.getFieldMapping(name); if (!fMapping.isComplex()) { throw new UnifyException(UnifyCoreErrorConstants.DOCUMENT_FIELDMAPPING_NOT_COMPLEX, fMapping.getDocFieldName(), fMapping.getBeanFieldName()); } writeFieldObject(fMapping, this, value); }
/** * Returns all getter/setter information for a bean class. * * @param beanClass * the bean class * @return a list of getter/setter method info * @throws UnifyException * if an error occurs */ public static List<GetterSetterInfo> getGetterSetterList(Class<?> beanClass) throws UnifyException { return caseSensitiveGetterSetterList.get(beanClass); }
public Object readFieldValue(PackableDocRWConfig rwConfig, String name) throws UnifyException { FieldConfig fc = config.getFieldConfig(name); if (!fc.isComplex()) { throw new UnifyException(UnifyCoreErrorConstants.DOCUMENT_FIELD_NOT_COMPLEX, name); } FieldMapping fMapping = rwConfig.getFieldMapping(name); if (!fMapping.isComplex()) { throw new UnifyException(UnifyCoreErrorConstants.DOCUMENT_FIELDMAPPING_NOT_COMPLEX, fMapping.getDocFieldName(), fMapping.getBeanFieldName()); } return readFieldObject(fMapping, this); }
/** * Creates a value store using supplied source object. * * @param sourceObject * the source object to use * @return ValueStore new instance of a value store * @throws UnifyException * if an error occurs */ protected ValueStore createValueStore(Object sourceObject) throws UnifyException { return valueStoreFactory.getValueStore(sourceObject, 0); }
public Class<?> getFieldType(String name) throws UnifyException { return config.getFieldConfig(name).getType(); }
@Override public int getValueIndex() { if (valueStore != null) { return valueStore.getDataIndex(); } return -1; }
@Override protected SimpleDateFormatPool createObject(Locale locale, String format, Object... params) throws Exception { return new SimpleDateFormatPool(format, locale); }
@Override public void write(int c) { ensureFit(1); data[len++] = (char) c; }
/** * Returns all getter/setter information for a bean class. * * @param beanClass * the bean class * @return a map of getter/setter method info by property name * @throws UnifyException * if an error occurs */ public static Map<String, GetterSetterInfo> getGetterSetterMap(Class<?> beanClass) throws UnifyException { return caseSensitiveGetterSetterMap.get(beanClass); }
@Override public List<? extends Listable> execute(Locale locale, ZeroParams params) throws UnifyException { return monthInYear.get(locale); } }
/** * Returns a list of all the bean compliant field names of a supplied type. * * @param beanClass * the bean type * @throws UnifyException * if an error occurs */ public static List<String> getBeanCompliantFieldNames(Class<?> beanClass) throws UnifyException { return beanFieldNamesMap.get(beanClass); }