private String formatVisibleTypes( TypeLookup typeLookup ) { return descriptors( typeLookup ) .map( descriptor -> { String moduleName = descriptor.module().name(); String typeName = descriptor.primaryType().getName(); return "\t\t[" + typeName + "] in [" + moduleName + "]"; } ) .sorted() .distinct() .collect( joining( NL, "\tVisible " + metaType + " types are:" + NL, "" ) ); }
private String formatVisibleTypes( TypeLookup typeLookup ) { return descriptors( typeLookup ) .map( descriptor -> { String moduleName = descriptor.module().name(); String typeName = descriptor.primaryType().getName(); return "\t\t[" + typeName + "] in [" + moduleName + "]"; } ) .sorted() .distinct() .collect( joining( NL, "\tVisible " + metaType + " types are:" + NL, "" ) ); }
private String findCandidateTypes( ModuleDescriptor module ) { return Stream.concat( Stream.of( module.layer() ), module.layer().usedLayers().layers() ) .flatMap( LayerDescriptor::modules ) .map( ModuleDescriptor::typeLookup ) .flatMap( this::descriptors ) .filter( type -> compositeType.equals( type.primaryType().getName() ) ) .map( descriptor -> { Class<?> primarytype = descriptor.primaryType(); String typeName = primarytype.getName(); return "\t\t[ " + typeName + "] in [" + descriptor.module().name() + "] with visibility " + descriptor.visibility(); } ) .distinct() .collect( joining( NL, "\tInvisible " + metaType + " types are:" + NL, "" ) ); }
private String findCandidateTypes( ModuleDescriptor module ) { return Stream.concat( Stream.of( module.layer() ), module.layer().usedLayers().layers() ) .flatMap( LayerDescriptor::modules ) .map( ModuleDescriptor::typeLookup ) .flatMap( this::descriptors ) .filter( type -> compositeType.equals( type.primaryType().getName() ) ) .map( descriptor -> { Class<?> primarytype = descriptor.primaryType(); String typeName = primarytype.getName(); return "\t\t[ " + typeName + "] in [" + descriptor.module().name() + "] with visibility " + descriptor.visibility(); } ) .distinct() .collect( joining( NL, "\tInvisible " + metaType + " types are:" + NL, "" ) ); }
private Object doGuessDeserialize( ModuleDescriptor module, ValueType valueType, Node xml ) { // TODO Could do better by detecting <collection/>, <map/> and <value/> Optional<String> typeInfo = getTypeInfo( xml ); if( typeInfo.isPresent() ) { StatefulAssociationCompositeDescriptor descriptor = statefulCompositeDescriptorFor( module, typeInfo.get() ); if( descriptor != null ) { return deserializeStatefulAssociationValue( ( (CompositeDescriptor) descriptor ).module(), descriptor.valueType(), xml ); } } throw new SerializationException( "Don't know how to deserialize " + valueType + " from " + xml ); }
if( descriptor != null ) return deserializeStatefulAssociationValue( ( (CompositeDescriptor) descriptor ).module(), descriptor.valueType(), mapValue );
@SuppressWarnings( "unchecked" ) private <T> T doGuessDeserialize( ModuleDescriptor module, ValueType valueType, JsonValue json ) { switch( json.getValueType() ) { case OBJECT: JsonObject object = (JsonObject) json; String typeInfo = object.getString( settings.getTypeInfoPropertyName(), valueType.primaryType().getName() ); StatefulAssociationCompositeDescriptor descriptor = statefulCompositeDescriptorFor( module, typeInfo ); if( descriptor != null ) { return (T) deserializeStatefulAssociationValue( ( (CompositeDescriptor) descriptor ).module(), descriptor.valueType(), object ); } default: throw new SerializationException( "Don't know how to deserialize " + valueType + " from " + json ); } }
@SuppressWarnings( "unchecked" ) private <T> T doGuessDeserialize( ModuleDescriptor module, ValueType valueType, JsonValue json ) { switch( json.getValueType() ) { case OBJECT: JsonObject object = (JsonObject) json; String typeInfo = object.getString( settings.getTypeInfoPropertyName(), valueType.primaryType().getName() ); StatefulAssociationCompositeDescriptor descriptor = statefulCompositeDescriptorFor( module, typeInfo ); if( descriptor != null ) { return (T) deserializeStatefulAssociationValue( ( (CompositeDescriptor) descriptor ).module(), descriptor.valueType(), object ); } default: throw new SerializationException( "Don't know how to deserialize " + valueType + " from " + json ); } }