String typeOf(FieldMetaData fmd) { return fmd.getType().getSimpleName(); } }
@SuppressWarnings({ "unchecked", "rawtypes" }) public static Serializer<Object> getSerializer(FieldMetaData fieldMetaData) { Serializer serializer = getSerializer(fieldMetaData.getTypeCode()); if (serializer instanceof ObjectSerializer) { Class<?> clazz = fieldMetaData.getType(); if (classSerializerMap.get(clazz) != null) { serializer = classSerializerMap.get(clazz); } } return serializer; }
/** * Validate that this field can be used for LRS. */ private void validateLRS() { if (!isLRS()) return; // can't use lrs for arrays if (getTypeCode() == JavaTypes.ARRAY) throw new MetaDataException(_loc.get("bad-lrs-array", this)); // can't use lrs for externalized vals if (getExternalizerMethod() != null) throw new MetaDataException(_loc.get("bad-lrs-extern", this)); // can't use lrs for concrete types if (getType() != Collection.class && getType() != Map.class && getType() != Set.class) throw new MetaDataException(_loc.get("bad-lrs-concrete", this)); }
private static boolean isGetter(Class<?> iface, FieldMetaData fmd) { if (fmd.getType() != boolean.class && fmd.getType() != Boolean.class) return true; try { Method meth = AccessController.doPrivileged( J2DoPrivHelper.getDeclaredMethodAction(iface, "is" + StringUtils.capitalize(fmd.getName()), (Class[]) null)); return meth == null; } catch (PrivilegedActionException pae) {} return true; }
/** * Validate that this field can be used for LRS. */ private void validateLRS() { if (!isLRS()) return; // can't use lrs for arrays if (getTypeCode() == JavaTypes.ARRAY) throw new MetaDataException(_loc.get("bad-lrs-array", this)); // can't use lrs for extranalized vals if (getExternalizerMethod() != null) throw new MetaDataException(_loc.get("bad-lrs-extern", this)); // can't use lrs for concrete types if (getType() != Collection.class && getType() != Map.class && getType() != Set.class) throw new MetaDataException(_loc.get("bad-lrs-concrete", this)); }
private static boolean isGetter(Class iface, FieldMetaData fmd) { if (fmd.getType() != boolean.class && fmd.getType() != Boolean.class) return true; try { Method meth = (Method) AccessController.doPrivileged( J2DoPrivHelper.getDeclaredMethodAction(iface, "is" + StringUtils.capitalize(fmd.getName()), (Class[]) null)); return meth == null; } catch (PrivilegedActionException pae) {} return true; }
/** * Validate that this field can be used for LRS. */ private void validateLRS() { if (!isLRS()) return; // can't use lrs for arrays if (getTypeCode() == JavaTypes.ARRAY) throw new MetaDataException(_loc.get("bad-lrs-array", this)); // can't use lrs for externalized vals if (getExternalizerMethod() != null) throw new MetaDataException(_loc.get("bad-lrs-extern", this)); // can't use lrs for concrete types if (getType() != Collection.class && getType() != Map.class && getType() != Set.class) throw new MetaDataException(_loc.get("bad-lrs-concrete", this)); }
private static boolean isGetter(Class<?> iface, FieldMetaData fmd) { if (fmd.getType() != boolean.class && fmd.getType() != Boolean.class) return true; try { Method meth = AccessController.doPrivileged( J2DoPrivHelper.getDeclaredMethodAction(iface, "is" + StringUtils.capitalize(fmd.getName()), (Class[]) null)); return meth == null; } catch (PrivilegedActionException pae) {} return true; }
/** * Validate that this field can be used for LRS. */ private void validateLRS() { if (!isLRS()) return; // can't use lrs for arrays if (getTypeCode() == JavaTypes.ARRAY) throw new MetaDataException(_loc.get("bad-lrs-array", this)); // can't use lrs for externalized vals if (getExternalizerMethod() != null) throw new MetaDataException(_loc.get("bad-lrs-extern", this)); // can't use lrs for concrete types if (getType() != Collection.class && getType() != Map.class && getType() != Set.class) throw new MetaDataException(_loc.get("bad-lrs-concrete", this)); }
private static boolean isGetter(Class<?> iface, FieldMetaData fmd) { if (fmd.getType() != boolean.class && fmd.getType() != Boolean.class) return true; try { Method meth = AccessController.doPrivileged( J2DoPrivHelper.getDeclaredMethodAction(iface, "is" + StringUtil.capitalize(fmd.getName()), (Class[]) null)); return meth == null; } catch (PrivilegedActionException pae) {} return true; }
/** * Validate that this field can be used for LRS. */ private void validateLRS() { if (!isLRS()) return; // can't use lrs for arrays if (getTypeCode() == JavaTypes.ARRAY) throw new MetaDataException(_loc.get("bad-lrs-array", this)); // can't use lrs for externalized vals if (getExternalizerMethod() != null) throw new MetaDataException(_loc.get("bad-lrs-extern", this)); // can't use lrs for concrete types if (getType() != Collection.class && getType() != Map.class && getType() != Set.class) throw new MetaDataException(_loc.get("bad-lrs-concrete", this)); }
private static boolean isGetter(Class<?> iface, FieldMetaData fmd) { if (fmd.getType() != boolean.class && fmd.getType() != Boolean.class) return true; try { Method meth = AccessController.doPrivileged( J2DoPrivHelper.getDeclaredMethodAction(iface, "is" + StringUtil.capitalize(fmd.getName()), (Class[]) null)); return meth == null; } catch (PrivilegedActionException pae) {} return true; }
/** * * @see org.seasar.framework.jpa.metadata.AttributeDesc#getTemporalType() */ public TemporalType getTemporalType() { Class<?> type = fieldMetaData.getType(); if (type == Date.class || type == Calendar.class) { return TemporalTypeUtil.fromSqlTypeToTemporalType(getSqlType()); } return null; }
/** * Categorizes the attribute. */ public final PersistentAttributeType getPersistentAttributeType() { if (!fmd.isDeclaredTypePC()) return super.getPersistentAttributeType(); if (fmd.getValue().isEmbedded() && fmd.getAssociationType() == 0) { return PersistentAttributeType.EMBEDDED; } return fmd.getMappedByMetaData() == null || !fmd.getType().isAssignableFrom(Collection.class) ? PersistentAttributeType.ONE_TO_ONE : PersistentAttributeType.ONE_TO_MANY; } }
/** * Categorizes the attribute. */ public final PersistentAttributeType getPersistentAttributeType() { if (!fmd.isDeclaredTypePC()) return super.getPersistentAttributeType(); if (fmd.getValue().isEmbedded() && fmd.getAssociationType() == 0) { return PersistentAttributeType.EMBEDDED; } return fmd.getMappedByMetaData() == null || !fmd.getType().isAssignableFrom(Collection.class) ? PersistentAttributeType.ONE_TO_ONE : PersistentAttributeType.ONE_TO_MANY; } }
/** * Categorizes the attribute. */ public final PersistentAttributeType getPersistentAttributeType() { if (!fmd.isDeclaredTypePC()) return super.getPersistentAttributeType(); if (fmd.getValue().isEmbedded() && fmd.getAssociationType() == 0) { return PersistentAttributeType.EMBEDDED; } return fmd.getMappedByMetaData() == null || !fmd.getType().isAssignableFrom(Collection.class) ? PersistentAttributeType.ONE_TO_ONE : PersistentAttributeType.ONE_TO_MANY; } }
/** * Categorizes the attribute. */ public final PersistentAttributeType getPersistentAttributeType() { if (!fmd.isDeclaredTypePC()) return super.getPersistentAttributeType(); if (fmd.getValue().isEmbedded() && fmd.getAssociationType() == 0) { return PersistentAttributeType.EMBEDDED; } return fmd.getMappedByMetaData() == null || !fmd.getType().isAssignableFrom(Collection.class) ? PersistentAttributeType.ONE_TO_ONE : PersistentAttributeType.ONE_TO_MANY; } }
private static Set<Class<?>> collectRelatedUnspecifiedTypes(ClassMetaData meta, Collection<? extends Class<?>> classes, Set<Class<?>> unspecified) { unspecified = collectUnspecifiedType(meta.getPCSuperclass(), classes, unspecified); for (FieldMetaData fmd : meta.getFields()) { if (fmd.isTransient()) continue; if (fmd.isTypePC()) unspecified = collectUnspecifiedType(fmd.getType(), classes, unspecified); if (fmd.getElement() != null && fmd.getElement().isTypePC()) unspecified = collectUnspecifiedType(fmd.getElement().getType(), classes, unspecified); if (fmd.getKey() != null && fmd.getKey().isTypePC()) unspecified = collectUnspecifiedType(fmd.getKey().getType(), classes, unspecified); if (fmd.getValue() != null && fmd.getValue().isTypePC()) unspecified = collectUnspecifiedType(fmd.getValue().getType(), classes, unspecified); } return unspecified; }
private static Set<Class<?>> collectRelatedUnspecifiedTypes(ClassMetaData meta, Collection<? extends Class<?>> classes, Set<Class<?>> unspecified) { unspecified = collectUnspecifiedType(meta.getPCSuperclass(), classes, unspecified); for (FieldMetaData fmd : meta.getFields()) { if (fmd.isTransient()) continue; if (fmd.isTypePC()) unspecified = collectUnspecifiedType(fmd.getType(), classes, unspecified); if (fmd.getElement() != null && fmd.getElement().isTypePC()) unspecified = collectUnspecifiedType(fmd.getElement().getType(), classes, unspecified); if (fmd.getKey() != null && fmd.getKey().isTypePC()) unspecified = collectUnspecifiedType(fmd.getKey().getType(), classes, unspecified); if (fmd.getValue() != null && fmd.getValue().isTypePC()) unspecified = collectUnspecifiedType(fmd.getValue().getType(), classes, unspecified); } return unspecified; }
private static Set<Class<?>> collectRelatedUnspecifiedTypes(ClassMetaData meta, Collection<? extends Class<?>> classes, Set<Class<?>> unspecified) { unspecified = collectUnspecifiedType(meta.getPCSuperclass(), classes, unspecified); for (FieldMetaData fmd : meta.getFields()) { if (fmd.isTransient()) continue; if (fmd.isTypePC()) unspecified = collectUnspecifiedType(fmd.getType(), classes, unspecified); if (fmd.getElement() != null && fmd.getElement().isTypePC()) unspecified = collectUnspecifiedType(fmd.getElement().getType(), classes, unspecified); if (fmd.getKey() != null && fmd.getKey().isTypePC()) unspecified = collectUnspecifiedType(fmd.getKey().getType(), classes, unspecified); if (fmd.getValue() != null && fmd.getValue().isTypePC()) unspecified = collectUnspecifiedType(fmd.getValue().getType(), classes, unspecified); } return unspecified; }