public static EcoreTypeInfo getTypeProperty ( final EClassifier classifier ) { String property = getValue ( classifier , "JsonType" , "property" ) ; String use = getValue ( classifier , "JsonType" , "use" ) ; ValueReader < String , EClass > valueReader = EcoreTypeInfo . defaultValueReader ; ValueWriter < EClass , String > valueWriter = EcoreTypeInfo . defaultValueWriter ; if ( use != null ) { EcoreTypeInfo . USE useType = EcoreTypeInfo . USE . valueOf ( use . toUpperCase ( ) ) ; if ( useType == NAME ) { valueReader = ( value , context ) -> { EClass type = value != null && value . equalsIgnoreCase ( classifier . getName ( ) ) ? ( EClass ) classifier : null ; if ( type == null ) { type = EMFContext . findEClassByName ( value , classifier . getEPackage ( ) ) ; } return type ; } ; valueWriter = ( value , context ) -> value . getName ( ) ; } else if ( useType == CLASS ) { valueReader = ( value , context ) -> { EClass type = value != null && value . equalsIgnoreCase ( classifier . getInstanceClassName ( ) ) ? ( EClass ) classifier : null ; if ( type == null ) { type = EMFContext . findEClassByQualifiedName ( value , classifier . getEPackage ( ) ) ; } return type ; } ; valueWriter = ( value , context ) -> value . getInstanceClassName ( ) ; } else { valueReader = EcoreTypeInfo . defaultValueReader ; valueWriter = EcoreTypeInfo . defaultValueWriter ; } } return property != null ? new EcoreTypeInfo ( property , valueReader , valueWriter ) : null ; }
Returns the property that should be use to store the type information of the classifier .