Module com.speedment.common.codegen
Interface HasFields<T extends HasFields<T>>
-
- Type Parameters:
T- The extending type
- All Known Subinterfaces:
Annotation,AnonymousValue,Class,ClassOrInterface<T>,Constructor,Enum,EnumConstant,Interface,InterfaceMethod,Method
public interface HasFields<T extends HasFields<T>>A trait for models that containFieldcomponents.- Since:
- 2.0
- Author:
- Emil Forslund
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default Tadd(Field field)Adds the specifiedFieldto this model.default TaddAllFields(Collection<? extends Field> fields)Adds all the specifiedFieldmembers to this model.default Tconstant(String name, Type type, Value<?> value)Creates a public final staticFieldwith the specified value and adds it to this model.default Tconstant(String name, Type type, Boolean value)Creates a public final staticFieldwith the specified value and adds it to this model.default Tconstant(String name, Type type, Number value)Creates a public final staticFieldwith the specified value and adds it to this model.default Tconstant(String name, Type type, String value)Creates a public final staticFieldwith the specified value and adds it to this model.default Tfield(String name, Type type)Creates aFieldand adds it to this model.default Tfield(String name, String type)Creates aFieldand adds it to this model.List<Field>getFields()Returns a list of all the fields in this model.
-
-
-
Method Detail
-
add
default T add(Field field)
Adds the specifiedFieldto this model.- Parameters:
field- the new child- Returns:
- a reference to this
-
field
default T field(String name, String type)
Creates aFieldand adds it to this model. The field will be given the default modifiers for this type, for an example, aClasswill bepublic final. The type will be constructed using the default implementation.- Parameters:
name- the name of the fieldtype- the type of the field- Returns:
- a reference to this
- Since:
- 2.5
-
field
default T field(String name, Type type)
Creates aFieldand adds it to this model. The field will be given the default modifiers for this type, for an example, aClasswill bepublic final.- Parameters:
name- the name of the fieldtype- the type of the field- Returns:
- a reference to this
- Since:
- 2.5
-
constant
default T constant(String name, Type type, Value<?> value)
Creates a public final staticFieldwith the specified value and adds it to this model.- Parameters:
name- the name of the fieldtype- the type of the fieldvalue- the value of the field- Returns:
- a reference to this
- Since:
- 2.5
-
constant
default T constant(String name, Type type, String value)
Creates a public final staticFieldwith the specified value and adds it to this model.- Parameters:
name- the name of the fieldtype- the type of the fieldvalue- the value of the field- Returns:
- a reference to this
- Since:
- 2.5
-
constant
default T constant(String name, Type type, Number value)
Creates a public final staticFieldwith the specified value and adds it to this model.- Parameters:
name- the name of the fieldtype- the type of the fieldvalue- the value of the field- Returns:
- a reference to this
- Since:
- 2.5
-
constant
default T constant(String name, Type type, Boolean value)
Creates a public final staticFieldwith the specified value and adds it to this model.- Parameters:
name- the name of the fieldtype- the type of the fieldvalue- the value of the field- Returns:
- a reference to this
- Since:
- 2.5
-
addAllFields
default T addAllFields(Collection<? extends Field> fields)
Adds all the specifiedFieldmembers to this model.- Parameters:
fields- the new children- Returns:
- a reference to this
-
-