Class MetamodelHelper


  • public class MetamodelHelper
    extends java.lang.Object
    Static utility for analyzing persistent metadata model using JPA 2.0.
    Author:
    Pinaki Poddar
    • 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)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • 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
    • Constructor Detail

      • MetamodelHelper

        public MetamodelHelper()
    • 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.