Class FactoryDefinition<T>

java.lang.Object
se.l4.commons.serialization.internal.reflection.FactoryDefinition<T>

public class FactoryDefinition<T>
extends Object
Factory that can be used to create an instance of a certain object.
Author:
Andreas Holstenson
  • Constructor Details

    • FactoryDefinition

      public FactoryDefinition​(Constructor<?> raw, se.l4.commons.serialization.internal.reflection.FactoryDefinition.Argument[] arguments, boolean hasSerializedFields, boolean isInjectable)
  • Method Details

    • resolve

      public static <T> FactoryDefinition<T> resolve​(SerializerCollection collection, Type parentType, Map<String,​FieldDefinition> fields, Map<String,​FieldDefinition> nonRenamed, com.fasterxml.classmate.members.ResolvedConstructor constructor)
    • hasSerializedFields

      public boolean hasSerializedFields()
      Get if this factory has any serialized fields.
      Returns:
    • isInjectable

      public boolean isInjectable()
      Get if this factory is marked as injectable.
      Returns:
    • getFieldCount

      public int getFieldCount()
      Get the number of fields this factory covers.
      Returns:
    • getScore

      public int getScore​(Map<String,​Object> data)
      Get a score for this factory based on the given data. The higher the score the more arguments were found.
      Parameters:
      data -
      Returns:
    • create

      public T create​(Map<String,​Object> data)
      Create a new instance using the given deserialized data. The data is only used if this factory has any serialized fields.
      Parameters:
      data -
      Returns:
    • create

      public T create​(Object[] args)
      Create a new instance using a plain arguments array.
      Parameters:
      args -
      Returns:
    • toString

      public String toString()
      Overrides:
      toString in class Object