/** * Creates a {@link Field} and adds it to this model. The field will be * given the default modifiers for this type, for an example, a * {@link Class} will be {@code public final}. * * @param name the name of the field * @param type the type of the field * @return a reference to this * * @since 2.5 */ default T field(final String name, Type type) { return add(Field.of(name, type).public_().final_()); }
/** * Creates a public final static {@link Field} with the specified value and * adds it to this model. * * @param name the name of the field * @param type the type of the field * @param value the value of the field * @return a reference to this * * @since 2.5 */ default T constant(final String name, Type type, Value<?> value) { return add(Field.of(name, type) .public_().final_().static_() .set(value) ); }
/** * Creates a {@link Field} and adds it to this model. The field will be * given the default modifiers for this type, for an example, a * {@link Class} will be {@code public final}. * * @param name the name of the field * @param type the type of the field * @return a reference to this * * @since 2.5 */ default T field(final String name, Type type) { return add(Field.of(name, type).public_().final_()); }
/** * Creates a public final static {@link Field} with the specified value and * adds it to this model. * * @param name the name of the field * @param type the type of the field * @param value the value of the field * @return a reference to this * * @since 2.5 */ default T constant(final String name, Type type, Value<?> value) { return add(Field.of(name, type) .public_().final_().static_() .set(value) ); }