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 Summary
Constructors Constructor Description FactoryDefinition(Constructor<?> raw, se.l4.commons.serialization.internal.reflection.FactoryDefinition.Argument[] arguments, boolean hasSerializedFields, boolean isInjectable) -
Method Summary
Modifier and Type Method Description Tcreate(Object[] args)Create a new instance using a plain arguments array.Tcreate(Map<String,Object> data)Create a new instance using the given deserialized data.intgetFieldCount()Get the number of fields this factory covers.intgetScore(Map<String,Object> data)Get a score for this factory based on the given data.booleanhasSerializedFields()Get if this factory has any serialized fields.booleanisInjectable()Get if this factory is marked as injectable.static <T> FactoryDefinition<T>resolve(SerializerCollection collection, Type parentType, Map<String,FieldDefinition> fields, Map<String,FieldDefinition> nonRenamed, com.fasterxml.classmate.members.ResolvedConstructor constructor)StringtoString()
-
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
Get a score for this factory based on the given data. The higher the score the more arguments were found.- Parameters:
data-- Returns:
-
create
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
Create a new instance using a plain arguments array.- Parameters:
args-- Returns:
-
toString
-