Class ModelDescriptor

java.lang.Object
nl.datasteel.crudcraft.codegen.descriptor.model.ModelDescriptor

public class ModelDescriptor extends Object
Metadata for a model composed of distinct descriptor parts.
  • Constructor Details

    • ModelDescriptor

      public ModelDescriptor(ModelIdentity identity, ModelFlags flags, EndpointOptions endpoints, ModelSecurity security)
      Constructs a ModelDescriptor with the provided identity, flags, endpoints, and security options.
      Parameters:
      identity - the core identity of the model
      flags - the flags indicating properties of the model
      endpoints - the options for endpoints associated with the model
      security - the security options for the model
  • Method Details

    • getName

      public String getName()
      Returns the name of the model, which is used for generating code and identifying the model.
      Returns:
      the name of the model as a String
    • getPackageName

      public String getPackageName()
      Returns the package name of the model, which is used for organizing code and avoiding naming conflicts.
    • getBasePackage

      public String getBasePackage()
      Returns the base package of the model, which is used for generating code. This is typically the package where the model's classes are located.
      Returns:
      the base package as a String
    • getFields

      public List<FieldDescriptor> getFields()
      Returns the fields of the model, which are defined in the ModelIdentity.
      Returns:
      a list of FieldDescriptor objects representing the fields of the model
    • isEditable

      public boolean isEditable()
      Returns the identity of the model, which includes its name, package, and fields.
      Returns:
      the ModelIdentity object representing the model's identity
    • isCrudCraftEntity

      public boolean isCrudCraftEntity()
      Returns whether the model is a CrudCraft entity, meaning it is part of the CrudCraft framework.
      Returns:
      true if the model is a CrudCraft entity, false otherwise
    • isEmbeddable

      public boolean isEmbeddable()
      Returns whether the model is embeddable, meaning it can be used as a part of another entity.
      Returns:
      true if the model is embeddable, false otherwise
    • getTemplate

      public CrudTemplate getTemplate()
      Returns the template used for generating endpoints for this model.
      Returns:
      the CrudTemplate object representing the template
    • getOmitEndpoints

      public CrudEndpoint[] getOmitEndpoints()
      Returns the endpoints that should be omitted during controller generation.
      Returns:
      an array of omitted CrudEndpoint objects
    • getIncludeEndpoints

      public CrudEndpoint[] getIncludeEndpoints()
      Returns the endpoints that should be included during controller generation.
      Returns:
      an array of included CrudEndpoint objects
    • getEndpointPolicy

      public Class<? extends CrudEndpointPolicy> getEndpointPolicy()
      Returns the custom endpoint policy, if defined.
    • isSecure

      public boolean isSecure()
      Returns whether the model is secure, meaning it has a defined security policy.
      Returns:
      true if the model is secure, false otherwise
    • getSecurityPolicy

      public Class<? extends CrudSecurityPolicy> getSecurityPolicy()
      Returns the class that implements the security policy for this model.
      Returns:
      the class implementing CrudSecurityPolicy for this model
    • getRowSecurityHandlers

      public List<String> getRowSecurityHandlers()
      Returns the class names that handle row-level security for this model.
      Returns:
      list of fully qualified row security handler class names
    • equals

      public boolean equals(Object o)
      Returns the identity of the model, which includes its name, package, and fields.
      Overrides:
      equals in class Object
      Returns:
      the ModelIdentity object representing the model's identity
    • hashCode

      public int hashCode()
      Computes a hash code for the ModelDescriptor based on its identity, flags, endpoints, and security options.
      Overrides:
      hashCode in class Object
      Returns:
      an integer hash code
    • toString

      public String toString()
      Returns a string representation of the ModelDescriptor.
      Overrides:
      toString in class Object
      Returns:
      a string containing the model's identity, flags, endpoints, and security options