/** * Return the metadata for the persistent or transactional field with * the given name. * * @return the field's metadata, or null if not found */ public FieldMetaData getField(String name) { FieldMetaData fmd = getDeclaredField(name); if (fmd != null) return fmd; if (_supFieldMap != null && _defSupFields) { fmd = (FieldMetaData) _supFieldMap.get(name); if (fmd != null) return fmd; } if (_super != null) return getPCSuperclassMetaData().getField(name); return null; }
/** * Return whether the given name represents a managed or static field of * this class, including superclass fields. */ public boolean isAccessibleField(String field) { if (getDeclaredField(field) != null) return true; if (_staticFields == null) { Field[] fields = (Field[]) AccessController.doPrivileged( J2DoPrivHelper.getDeclaredFieldsAction(_type)); Set<String> names = new HashSet<String>(); for (int i = 0; i < fields.length; i++) if (Modifier.isStatic(fields[i].getModifiers())) names.add(fields[i].getName()); _staticFields = names; } if (_staticFields.contains(field)) return true; if (_super != null) return getPCSuperclassMetaData().isAccessibleField(field); return false; }
/** * Return whether the given name represents a managed or static field of * this class, including superclass fields. */ public boolean isAccessibleField(String field) { if (getDeclaredField(field) != null) return true; if (_staticFields == null) { Field[] fields = (Field[]) AccessController.doPrivileged( J2DoPrivHelper.getDeclaredFieldsAction(_type)); Set<String> names = new HashSet<String>(); for (int i = 0; i < fields.length; i++) if (Modifier.isStatic(fields[i].getModifiers())) names.add(fields[i].getName()); _staticFields = names; } if (_staticFields.contains(field)) return true; if (_super != null) return getPCSuperclassMetaData().isAccessibleField(field); return false; }
/** * Return whether the given name represents a managed or static field of * this class, including superclass fields. */ public boolean isAccessibleField(String field) { if (getDeclaredField(field) != null) return true; if (_staticFields == null) { Field[] fields = (Field[]) AccessController.doPrivileged( J2DoPrivHelper.getDeclaredFieldsAction(_type)); Set<String> names = new HashSet<String>(); for (int i = 0; i < fields.length; i++) if (Modifier.isStatic(fields[i].getModifiers())) names.add(fields[i].getName()); _staticFields = names; } if (_staticFields.contains(field)) return true; if (_super != null) return getPCSuperclassMetaData().isAccessibleField(field); return false; }
/** * Return whether the given name represents a managed or static field of * this class, including superclass fields. */ public boolean isAccessibleField(String field) { if (getDeclaredField(field) != null) return true; if (_staticFields == null) { Field[] fields = (Field[]) AccessController.doPrivileged( J2DoPrivHelper.getDeclaredFieldsAction(_type)); Set names = new HashSet((int) (fields.length * 1.33 + 1)); for (int i = 0; i < fields.length; i++) if (Modifier.isStatic(fields[i].getModifiers())) names.add(fields[i].getName()); _staticFields = names; } if (_staticFields.contains(field)) return true; if (_super != null) return getPCSuperclassMetaData().isAccessibleField(field); return false; }
/** * Return whether the given name represents a managed or static field of * this class, including superclass fields. */ public boolean isAccessibleField(String field) { if (getDeclaredField(field) != null) return true; if (_staticFields == null) { Field[] fields = (Field[]) AccessController.doPrivileged( J2DoPrivHelper.getDeclaredFieldsAction(_type)); Set<String> names = new HashSet<String>(); for (int i = 0; i < fields.length; i++) if (Modifier.isStatic(fields[i].getModifiers())) names.add(fields[i].getName()); _staticFields = names; } if (_staticFields.contains(field)) return true; if (_super != null) return getPCSuperclassMetaData().isAccessibleField(field); return false; }
/** * Return the metadata for the persistent or transactional field with * the given name. * * @return the field's metadata, or null if not found */ public FieldMetaData getField(String name) { FieldMetaData fmd = getDeclaredField(name); if (fmd != null) return fmd; if (_supFieldMap != null && _defSupFields) { fmd = (FieldMetaData) _supFieldMap.get(name); if (fmd != null) return fmd; } if (_super != null) return getPCSuperclassMetaData().getField(name); return null; }
/** * Return the metadata for the persistent or transactional field with * the given name. * * @return the field's metadata, or null if not found */ public FieldMetaData getField(String name) { FieldMetaData fmd = getDeclaredField(name); if (fmd != null) return fmd; if (_supFieldMap != null && _defSupFields) { fmd = (FieldMetaData) _supFieldMap.get(name); if (fmd != null) return fmd; } if (_super != null) return getPCSuperclassMetaData().getField(name); return null; }
/** * Return the metadata for the persistent or transactional field with * the given name. * * @return the field's metadata, or null if not found */ public FieldMetaData getField(String name) { FieldMetaData fmd = getDeclaredField(name); if (fmd != null) return fmd; if (_supFieldMap != null && _defSupFields) { fmd = (FieldMetaData) _supFieldMap.get(name); if (fmd != null) return fmd; } if (_super != null) return getPCSuperclassMetaData().getField(name); return null; }
/** * Return the metadata for the persistent or transactional field with * the given name. * * @return the field's metadata, or null if not found */ public FieldMetaData getField(String name) { FieldMetaData fmd = getDeclaredField(name); if (fmd != null) return fmd; if (_supFieldMap != null && _defSupFields) { fmd = (FieldMetaData) _supFieldMap.get(name); if (fmd != null) return fmd; } if (_super != null) return getPCSuperclassMetaData().getField(name); return null; }
.getDeclaredTypeMetaData(); if (elemCls != null) { FieldMetaData fmd = elemCls.getDeclaredField(decs[i]); if (fmd != null) fmd.setUsedInOrderBy(true);
.getDeclaredTypeMetaData(); if (elemCls != null) { FieldMetaData fmd = elemCls.getDeclaredField(decs[i]); if (fmd != null) fmd.setUsedInOrderBy(true);
.getDeclaredTypeMetaData(); if (elemCls != null) { FieldMetaData fmd = elemCls.getDeclaredField(decs[i]); if (fmd != null) fmd.setUsedInOrderBy(true);
/** * Set a field's fetch group. */ private static void parseFetchAttribute(ClassMetaData meta, org.apache.openjpa.meta.FetchGroup fg, FetchAttributeImpl attr) { FieldMetaData field = meta.getDeclaredField(attr.name()); if (field == null || field.getManagement() != FieldMetaData.MANAGE_PERSISTENT) throw new MetaDataException(_loc.get("bad-fg-field", fg.getName(), meta, attr.name())); field.setInFetchGroup(fg.getName(), true); Set<String> parentFetchGroups = fg.getContainedBy(); for (Object parentFetchGroup : parentFetchGroups) field.setInFetchGroup(parentFetchGroup.toString(), true); if (attr.recursionDepth() != Integer.MIN_VALUE) fg.setRecursionDepth(field, attr.recursionDepth()); }
/** * Set a field's fetch group. */ private void parseFetchAttribute(ClassMetaData meta, org.apache.openjpa.meta.FetchGroup fg, FetchAttribute attr) { FieldMetaData field = meta.getDeclaredField(attr.name()); if (field == null || field.getManagement() != FieldMetaData.MANAGE_PERSISTENT) throw new MetaDataException(_loc.get("bad-fg-field", fg.getName(), meta, attr.name())); field.setInFetchGroup(fg.getName(), true); Set parentFetchGroups = fg.getContainedBy(); for (Object parentFetchGroup:parentFetchGroups) field.setInFetchGroup(parentFetchGroup.toString(), true); if (attr.recursionDepth() != Integer.MIN_VALUE) fg.setRecursionDepth(field, attr.recursionDepth()); }
/** * Set a field's fetch group. */ private static void parseFetchAttribute(ClassMetaData meta, org.apache.openjpa.meta.FetchGroup fg, FetchAttributeImpl attr) { FieldMetaData field = meta.getDeclaredField(attr.name()); if (field == null || field.getManagement() != FieldMetaData.MANAGE_PERSISTENT) throw new MetaDataException(_loc.get("bad-fg-field", fg.getName(), meta, attr.name())); field.setInFetchGroup(fg.getName(), true); Set<String> parentFetchGroups = fg.getContainedBy(); for (Object parentFetchGroup : parentFetchGroups) field.setInFetchGroup(parentFetchGroup.toString(), true); if (attr.recursionDepth() != Integer.MIN_VALUE) fg.setRecursionDepth(field, attr.recursionDepth()); }
/** * Set a field's fetch group. */ private static void parseFetchAttribute(ClassMetaData meta, org.apache.openjpa.meta.FetchGroup fg, FetchAttributeImpl attr) { FieldMetaData field = meta.getDeclaredField(attr.name()); if (field == null || field.getManagement() != FieldMetaData.MANAGE_PERSISTENT) throw new MetaDataException(_loc.get("bad-fg-field", fg.getName(), meta, attr.name())); field.setInFetchGroup(fg.getName(), true); Set<String> parentFetchGroups = fg.getContainedBy(); for (Object parentFetchGroup : parentFetchGroups) field.setInFetchGroup(parentFetchGroup.toString(), true); if (attr.recursionDepth() != Integer.MIN_VALUE) fg.setRecursionDepth(field, attr.recursionDepth()); }
/** * Set a field's fetch group. */ private static void parseFetchAttribute(ClassMetaData meta, org.apache.openjpa.meta.FetchGroup fg, FetchAttributeImpl attr) { FieldMetaData field = meta.getDeclaredField(attr.name()); if (field == null || field.getManagement() != FieldMetaData.MANAGE_PERSISTENT) throw new MetaDataException(_loc.get("bad-fg-field", fg.getName(), meta, attr.name())); field.setInFetchGroup(fg.getName(), true); Set<String> parentFetchGroups = fg.getContainedBy(); for (Object parentFetchGroup : parentFetchGroups) field.setInFetchGroup(parentFetchGroup.toString(), true); if (attr.recursionDepth() != Integer.MIN_VALUE) fg.setRecursionDepth(field, attr.recursionDepth()); }
@Test public void testCollecitonFieldId() { OrderedCollectionField orderedCollectionField = new OrderedCollectionField( JPAFacadeHelper.getMetaData(entityManagerFactory, Store.class) .getDeclaredField("customers")); assertEquals(1, orderedCollectionField.getFieldId()); } }
FieldMetaData fmd = decl ? meta.getDeclaredField(name) : meta .getField(name);