Class JsonAnnotations


  • public final class JsonAnnotations
    extends Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static List<String> getAliases​(org.eclipse.emf.ecore.ENamedElement element)
      Returns the configured alias name or null, if there is none.
      static String getElementName​(org.eclipse.emf.ecore.ENamedElement element, int features)
      Returns the name that should be use to serialize the property.
      static String getIdentityProperty​(org.eclipse.emf.ecore.EClassifier classifier)
      Returns the property that should be use to serialize the identity of the object.
      static EcoreTypeInfo getTypeProperty​(org.eclipse.emf.ecore.EClassifier classifier)
      Returns the property that should be use to store the type information of the classifier.
      static EcoreTypeInfo getTypeProperty​(org.eclipse.emf.ecore.EClassifier classifier, ValueReader<String,​org.eclipse.emf.ecore.EClass> valueReader, ValueWriter<org.eclipse.emf.ecore.EClass,​String> valueWriter)
      Returns the property that should be use to store the type information of the classifier.
      protected static String getValue​(org.eclipse.emf.ecore.ENamedElement element, String annotation, String property)  
      protected static List<String> getValues​(org.eclipse.emf.ecore.ENamedElement element, String annotation, String property)  
      static boolean isRawValue​(org.eclipse.emf.ecore.EStructuralFeature feature)
      Returns true, if the feature is annotated to be treated as raw JSON.
      static boolean shouldIgnore​(org.eclipse.emf.ecore.EStructuralFeature feature)
      Returns true if the feature should not be serialize.
      static boolean shouldIgnoreType​(org.eclipse.emf.ecore.EClassifier classifier)
      Returns true if the classifier type information should not be serialize.
    • Method Detail

      • getElementName

        public static String getElementName​(org.eclipse.emf.ecore.ENamedElement element,
                                            int features)
        Returns the name that should be use to serialize the property.
        Parameters:
        element - any element
        features - the EMF module's feature flags
        Returns:
        name of property
      • getAliases

        public static List<String> getAliases​(org.eclipse.emf.ecore.ENamedElement element)
        Returns the configured alias name or null, if there is none.
        Parameters:
        element - any element
        Returns:
        the property's alias
      • shouldIgnore

        public static boolean shouldIgnore​(org.eclipse.emf.ecore.EStructuralFeature feature)
        Returns true if the feature should not be serialize.
        Parameters:
        feature - any feature
        Returns:
        true if should not be serialize
      • getTypeProperty

        public static EcoreTypeInfo getTypeProperty​(org.eclipse.emf.ecore.EClassifier classifier)
        Returns the property that should be use to store the type information of the classifier.
        Parameters:
        classifier - any classifier
        Returns:
        the type information property
      • getTypeProperty

        public static EcoreTypeInfo getTypeProperty​(org.eclipse.emf.ecore.EClassifier classifier,
                                                    ValueReader<String,​org.eclipse.emf.ecore.EClass> valueReader,
                                                    ValueWriter<org.eclipse.emf.ecore.EClass,​String> valueWriter)
        Returns the property that should be use to store the type information of the classifier.
        Parameters:
        classifier - any classifier
        valueReader - the reader to use for deserializing type info
        valueWriter - the reader to use for serializing type info
        Returns:
        the type information property
      • shouldIgnoreType

        public static boolean shouldIgnoreType​(org.eclipse.emf.ecore.EClassifier classifier)
        Returns true if the classifier type information should not be serialize. This is true when the classifier possesses an annotation @JsonType with include = "false".
        Parameters:
        classifier - any classifier
        Returns:
        true if type info should not be serialize
      • getIdentityProperty

        public static String getIdentityProperty​(org.eclipse.emf.ecore.EClassifier classifier)
        Returns the property that should be use to serialize the identity of the object.
        Parameters:
        classifier - any classifier
        Returns:
        the identity property
      • isRawValue

        public static boolean isRawValue​(org.eclipse.emf.ecore.EStructuralFeature feature)
        Returns true, if the feature is annotated to be treated as raw JSON.
        Parameters:
        feature - any feature
        Returns:
        true, if raw (de)serialization should be done for this feature
      • getValue

        protected static String getValue​(org.eclipse.emf.ecore.ENamedElement element,
                                         String annotation,
                                         String property)
      • getValues

        protected static List<String> getValues​(org.eclipse.emf.ecore.ENamedElement element,
                                                String annotation,
                                                String property)