private static <P> ModelRegistrations.Builder managedRegistrationBuilder( ModelPath childPath, ManagedProperty<P> property, NodeInitializerRegistry nodeInitializerRegistry, ModelType<?> publicType) { return ModelRegistrations.of( childPath, nodeInitializerRegistry.getNodeInitializer( forProperty(property.getType(), property, publicType))); }
private <P> void validateProperty( ModelSchema<P> propertySchema, ManagedProperty<P> property, NodeInitializerRegistry nodeInitializerRegistry) { if (propertySchema instanceof ManagedImplSchema) { if (!property.isWritable()) { if (isCollectionOfManagedTypes(propertySchema)) { CollectionSchema<P, ?> propertyCollectionsSchema = (CollectionSchema<P, ?>) propertySchema; ModelType<?> elementType = propertyCollectionsSchema.getElementType(); nodeInitializerRegistry.ensureHasInitializer( forProperty(elementType, property, bindings.getPublicSchema().getType())); } if (property.isDeclaredAsHavingUnmanagedType()) { throw new UnmanagedPropertyMissingSetterException(property.getName()); } } } else if (!shouldHaveANodeInitializer(property, propertySchema) && !property.isWritable() && !isNamePropertyOfANamedType(property)) { throw new ReadonlyImmutableManagedPropertyException( bindings.getPublicSchema().getType(), property.getName(), property.getType()); } }