Package jpa.tools.swing
Class MetamodelHelper
- java.lang.Object
-
- jpa.tools.swing.MetamodelHelper
-
public class MetamodelHelper extends java.lang.Object
Static utility for analyzing persistent metadata model using JPA 2.0.- Author:
- Pinaki Poddar
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MetamodelHelper.AttributeComparator
Compares attribute by their qualification.static class
MetamodelHelper.EntityComparator
Compares EntityType by their dependency of derived targets.
-
Field Summary
Fields Modifier and Type Field Description static int
ATTR_BASIC
static int
ATTR_ID
static int
ATTR_PLURAL_RELATION
static int
ATTR_SINGULAR_RELATION
static int
ATTR_VERSION
static java.awt.Color
DARK_GREEN
static java.awt.Color
KHAKI
static java.awt.Color
MIDNIGHT_BLUE
-
Constructor Summary
Constructors Constructor Description MetamodelHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> jakarta.persistence.metamodel.EntityType<?>
derivedTarget(jakarta.persistence.metamodel.EntityType<T> type)
Finds the derived target of the given type, if any.static <T> java.util.List<jakarta.persistence.metamodel.Attribute<? super T,?>>
getAttributes(jakarta.persistence.metamodel.EntityType<T> type)
static int
getAttributeType(jakarta.persistence.metamodel.Attribute<?,?> a)
static java.lang.Integer
getAttributeTypeCode(jakarta.persistence.metamodel.Attribute<?,?> attr)
static java.awt.Color
getColor(jakarta.persistence.metamodel.Attribute.PersistentAttributeType type)
static java.awt.Color
getColor(jakarta.persistence.metamodel.Attribute<?,?> attr)
static java.lang.String
getDisplayName(jakarta.persistence.metamodel.Attribute<?,?> attr)
static java.lang.String
getDisplayName(jakarta.persistence.metamodel.EntityType<?> type)
Gets the displayed name of a given entity type.static java.lang.String
getDisplayName(jakarta.persistence.metamodel.Type<?> type)
static java.lang.String
getDisplayName(java.lang.Class<?> cls)
static <T> java.util.Set<jakarta.persistence.metamodel.SingularAttribute<? super T,?>>
getIdAttributes(jakarta.persistence.metamodel.EntityType<T> type)
static jakarta.persistence.metamodel.EntityType<?>
getParentType(jakarta.persistence.metamodel.SingularAttribute<?,?> id)
static java.lang.Object
getValue(jakarta.persistence.metamodel.Attribute<?,?> attr, java.lang.Object instance)
Gets the value of the given persistent attribute for the given instance.static boolean
isId(jakarta.persistence.metamodel.Attribute<?,?> a)
static boolean
isVersion(jakarta.persistence.metamodel.Attribute<?,?> a)
-
-
-
Field Detail
-
ATTR_ID
public static final int ATTR_ID
- See Also:
- Constant Field Values
-
ATTR_VERSION
public static final int ATTR_VERSION
- See Also:
- Constant Field Values
-
ATTR_BASIC
public static final int ATTR_BASIC
- See Also:
- Constant Field Values
-
ATTR_SINGULAR_RELATION
public static final int ATTR_SINGULAR_RELATION
- See Also:
- Constant Field Values
-
ATTR_PLURAL_RELATION
public static final int ATTR_PLURAL_RELATION
- See Also:
- Constant Field Values
-
MIDNIGHT_BLUE
public static final java.awt.Color MIDNIGHT_BLUE
-
DARK_GREEN
public static final java.awt.Color DARK_GREEN
-
KHAKI
public static final java.awt.Color KHAKI
-
-
Method Detail
-
getDisplayName
public static java.lang.String getDisplayName(jakarta.persistence.metamodel.Type<?> type)
-
getDisplayName
public static java.lang.String getDisplayName(jakarta.persistence.metamodel.EntityType<?> type)
Gets the displayed name of a given entity type.
-
getDisplayName
public static java.lang.String getDisplayName(java.lang.Class<?> cls)
-
getDisplayName
public static java.lang.String getDisplayName(jakarta.persistence.metamodel.Attribute<?,?> attr)
-
getAttributes
public static <T> java.util.List<jakarta.persistence.metamodel.Attribute<? super T,?>> getAttributes(jakarta.persistence.metamodel.EntityType<T> type)
-
getAttributeType
public static int getAttributeType(jakarta.persistence.metamodel.Attribute<?,?> a)
-
getIdAttributes
public static <T> java.util.Set<jakarta.persistence.metamodel.SingularAttribute<? super T,?>> getIdAttributes(jakarta.persistence.metamodel.EntityType<T> type)
-
derivedTarget
public static <T> jakarta.persistence.metamodel.EntityType<?> derivedTarget(jakarta.persistence.metamodel.EntityType<T> type)
Finds the derived target of the given type, if any. Otherwise null.
-
getParentType
public static jakarta.persistence.metamodel.EntityType<?> getParentType(jakarta.persistence.metamodel.SingularAttribute<?,?> id)
-
isId
public static boolean isId(jakarta.persistence.metamodel.Attribute<?,?> a)
-
isVersion
public static boolean isVersion(jakarta.persistence.metamodel.Attribute<?,?> a)
-
getColor
public static java.awt.Color getColor(jakarta.persistence.metamodel.Attribute<?,?> attr)
-
getColor
public static java.awt.Color getColor(jakarta.persistence.metamodel.Attribute.PersistentAttributeType type)
-
getAttributeTypeCode
public static java.lang.Integer getAttributeTypeCode(jakarta.persistence.metamodel.Attribute<?,?> attr)
-
getValue
public static java.lang.Object getValue(jakarta.persistence.metamodel.Attribute<?,?> attr, java.lang.Object instance)
Gets the value of the given persistent attribute for the given instance.
-
-