@Override public boolean equals( Object o ) { if( this == o ) { return true; } if( o == null || getClass() != o.getClass() ) { return false; } if( !super.equals( o ) ) { return false; } ValueCompositeType that = (ValueCompositeType) o; return Objects.equals( model, that.model ); }
@Override public int hashCode() { return Objects.hash( super.hashCode(), model ); } }
valueType.properties().forEach( property -> valueElement.appendChild( element ); } ); valueType.associations().forEach( association -> valueType.manyAssociations().forEach( association -> valueType.namedAssociations().forEach( association -> if( ( root && options.rootTypeInfo() ) || ( !root && options.nestedTypeInfo() ) ) valueElement.setAttribute( settings.getTypeInfoTagName(), valueType.primaryType().getName() );
private Object deserializeStatefulAssociationValue( ModuleDescriptor module, StatefulAssociationValueType<?> valueType, Node xml ) { Optional<String> typeInfo = getTypeInfo( xml ); if( typeInfo.isPresent() ) { StatefulAssociationCompositeDescriptor descriptor = statefulCompositeDescriptorFor( module, typeInfo.get() ); if( descriptor == null ) { String typeInfoName = settings.getTypeInfoTagName(); throw new SerializationException( typeInfoName + ": " + typeInfo.get() + " could not be resolved while deserializing " + xml ); } valueType = descriptor.valueType(); } ValueBuilder builder = module.instance().newValueBuilderWithState( valueType.primaryType(), propertyFunction( valueType.module(), xml ), associationFunction( valueType.module(), xml ), manyAssociationFunction( valueType.module(), xml ), namedAssociationFunction( valueType.module(), xml ) ); return builder.newInstance(); }
if( StatefulAssociationValueType.isStatefulAssociationValue( objectClass ) )
valueType.properties().forEach( property -> valueType.associations().forEach( association -> builder.add( association.qualifiedName().name(), doSerialize( options, state.associationFor( association.accessor() ).reference(), false ) ) ); valueType.manyAssociations().forEach( association -> builder.add( association.qualifiedName().name(), .collect( toList() ), false ) ) ); valueType.namedAssociations().forEach( association -> builder.add( association.qualifiedName().name(),
private Object deserializeStatefulAssociationValue( ModuleDescriptor module, StatefulAssociationValueType<?> valueType, JsonObject json ) { String typeInfoName = settings.getTypeInfoPropertyName(); String typeInfo = json.getString( typeInfoName, null ); if( typeInfo != null ) { StatefulAssociationCompositeDescriptor descriptor = statefulCompositeDescriptorFor( module, typeInfo ); if( descriptor == null ) { throw new SerializationException( typeInfoName + ": " + typeInfo + " could not be resolved while deserializing " + json ); } valueType = descriptor.valueType(); } ValueBuilder builder = module.instance().newValueBuilderWithState( valueType.primaryType(), propertyFunction( valueType.module(), json ), associationFunction( valueType.module(), json ), manyAssociationFunction( valueType.module(), json ), namedAssociationFunction( valueType.module(), json ) ); return builder.newInstance(); }
if( StatefulAssociationValueType.isStatefulAssociationValue( objectClass ) )
valueType.properties().forEach( property -> valueType.associations().forEach( association -> builder.add( association.qualifiedName().name(), doSerialize( options, state.associationFor( association.accessor() ).reference(), false ) ) ); valueType.manyAssociations().forEach( association -> builder.add( association.qualifiedName().name(), .collect( toList() ), false ) ) ); valueType.namedAssociations().forEach( association -> builder.add( association.qualifiedName().name(),
valueType.primaryType(), propertyFunction( valueType.module(), namedValues ), associationFunction( valueType.module(), namedValues ), manyAssociationFunction( valueType.module(), namedValues ), namedAssociationFunction( valueType.module(), namedValues ) ); return builder.newInstance();
if( StatefulAssociationValueType.isStatefulAssociationValue( objectClass ) )
@Override public int hashCode() { return Objects.hash( super.hashCode(), model ); } }
@Override public boolean equals( Object o ) { if( this == o ) { return true; } if( o == null || getClass() != o.getClass() ) { return false; } if( !super.equals( o ) ) { return false; } EntityCompositeType that = (EntityCompositeType) o; return Objects.equals( model, that.model ); }
valueType.properties().forEach( property -> doSerialize( options, value, false ) ); } ); valueType.associations().forEach( association -> builder.put( ValueFactory.newString( association.qualifiedName().name() ), doSerialize( options, state.associationFor( association.accessor() ).reference(), false ) ) ); valueType.manyAssociations().forEach( association -> builder.put( ValueFactory.newString( association.qualifiedName().name() ), state.manyAssociationFor( association.accessor() ).references().collect( toList() ), false ) ) ); valueType.namedAssociations().forEach( association -> builder.put( ValueFactory.newString( association.qualifiedName().name() ), ValueFactory.newString( valueType.primaryType().getName() ) );
private Object deserializeStatefulAssociationValue( ModuleDescriptor module, StatefulAssociationValueType<?> valueType, JsonObject json ) { String typeInfoName = settings.getTypeInfoPropertyName(); String typeInfo = json.getString( typeInfoName, null ); if( typeInfo != null ) { StatefulAssociationCompositeDescriptor descriptor = statefulCompositeDescriptorFor( module, typeInfo ); if( descriptor == null ) { throw new SerializationException( typeInfoName + ": " + typeInfo + " could not be resolved while deserializing " + json ); } valueType = descriptor.valueType(); } ValueBuilder builder = module.instance().newValueBuilderWithState( valueType.primaryType(), propertyFunction( valueType.module(), json ), associationFunction( valueType.module(), json ), manyAssociationFunction( valueType.module(), json ), namedAssociationFunction( valueType.module(), json ) ); return builder.newInstance(); }
if( StatefulAssociationValueType.isStatefulAssociationValue( objectClass ) )
@Override public int hashCode() { return Objects.hash( super.hashCode(), model ); } }
@Override public boolean equals( Object o ) { if( this == o ) { return true; } if( o == null || getClass() != o.getClass() ) { return false; } if( !super.equals( o ) ) { return false; } ValueCompositeType that = (ValueCompositeType) o; return Objects.equals( model, that.model ); }
@Override public int hashCode() { return Objects.hash( super.hashCode(), model ); } }
@Override public boolean equals( Object o ) { if( this == o ) { return true; } if( o == null || getClass() != o.getClass() ) { return false; } if( !super.equals( o ) ) { return false; } EntityCompositeType that = (EntityCompositeType) o; return Objects.equals( model, that.model ); }