Bind to the given field for the message.

@param message The message tp bind value from.
@param field The field to bind to.
@param <M> The message type.
@param <F> The message field type.
@return The message field argument.
172287
public static <M extends PMessage<M,F>, F extends PField>
    MessageFieldArgument<M,F> toField(M message, F field) {
        return new MessageFieldArgument<>(message, field);
    }
966228
public static Object getValueOfField(Field field, Object ref) {
		field.setAccessible(true);
		Object value = null;
		try {
			value = field.get(ref);
		} catch (IllegalArgumentException e) {
			log.warning(e.getClass().getSimpleName() + ": " + e.getMessage());
		} catch (IllegalAccessException e) {
			log.warning(e.getClass().getSimpleName() + ": " + e.getMessage());
		}
		return value;
	}
446277
public static <X> String createFieldId(AnnotatedField<X> field) {
        return createFieldId(field.getJavaMember(), field.getAnnotations());
    }
1132760
protected Map<String, Object> getMessageVariables(final CellField<T> cellField) {

        final Map<String, Object> variables = new HashMap<>();
        variables.put("validatedValue", cellField.getValue());
        Optional.ofNullable(cellField.getFormatter())
            .ifPresent(f -> variables.put("fieldFormatter", f));
        return variables;

    }
871967
public static <A extends Annotation> A getAnnotation(Field field, Class<A> annotationType) {
        if (field == null || annotationType == null) {
            return null;
        }

        return field.getAnnotation(annotationType);
    }
704053
public <Message extends PMessage<Message, Field>, Field extends PField>
    String format(Message message) {
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        formatTo(out, message);
        return new String(out.toByteArray(), StandardCharsets.UTF_8);
    }
567229
public void rejectValue(final String field, final String errorCode, 
            final Map<String, Object> messageVariables, final String defaultMessage) {
        
        rejectValue(field, null, errorCode, Collections.emptyMap(), defaultMessage);
        
    }
343420
def _set_field_on_message(msg, key, value):
    """"""
    # Attempt to set the value on the types of objects we know how to deal
    # with.
    if isinstance(value, (collections_abc.MutableSequence, tuple)):
        # Clear the existing repeated protobuf message of any elements
        # currently inside it.
        while getattr(msg, key):
            getattr(msg, key).pop()

        # Write our new elements to the repeated field.
        for item in value:
            if isinstance(item, collections_abc.Mapping):
                getattr(msg, key).add(**item)
            else:
                # protobuf's RepeatedCompositeContainer doesn't support
                # append.
                getattr(msg, key).extend([item])
    elif isinstance(value, collections_abc.Mapping):
        # Assign the dictionary values to the protobuf message.
        for item_key, item_value in value.items():
            set(getattr(msg, key), item_key, item_value)
    elif isinstance(value, message.Message):
        getattr(msg, key).CopyFrom(value)
    else:
        setattr(msg, key, value)
210660
private void bindFields() {

        m_formBinderAfter = new Binder<>();
        m_formBinderAfter.bind(m_messageAfter, CmsLoginMessage::getMessage, CmsLoginMessage::setMessage);

        m_formBinderAfter.bind(
            m_enabledAfter,
            loginMessage -> Boolean.valueOf(loginMessage.isEnabled()),
            (loginMessage, enabled) -> loginMessage.setEnabled(enabled.booleanValue()));

        m_formBinderAfter.bind(
            m_logoutAfter,
            loginMessage -> Boolean.valueOf(loginMessage.isLoginForbidden()),
            (loginMessage, forbidden) -> loginMessage.setLoginForbidden(forbidden.booleanValue()));

        m_formBinderAfter.forField(m_endTimeAfter).withValidator(
            endTime -> hasValidTimes(),
            CmsVaadinUtils.getMessageText(Messages.GUI_MESSAGES_LOGINMESSAGE_VAL_DATE_0)).bind(
                loginMessage -> loginMessage.getTimeEnd() != CmsLoginMessage.DEFAULT_TIME_END
                ? CmsDateField.dateToLocalDateTime(new Date(loginMessage.getTimeEnd()))
                : null,
                (loginMessage, endTime) -> loginMessage.setTimeEnd(
                    endTime != null
                    ? CmsDateField.localDateTimeToDate(endTime).getTime()
                    : CmsLoginMessage.DEFAULT_TIME_END));
        m_formBinderAfter.forField(m_startTimeAfter).withValidator(
            startTime -> hasValidTimes(),
            CmsVaadinUtils.getMessageText(Messages.GUI_MESSAGES_LOGINMESSAGE_VAL_DATE_0)).bind(
                loginMessage -> loginMessage.getTimeStart() != CmsLoginMessage.DEFAULT_TIME_START
                ? CmsDateField.dateToLocalDateTime(new Date(loginMessage.getTimeStart()))
                : null,
                (loginMessage, startTime) -> loginMessage.setTimeStart(
                    startTime != null
                    ? CmsDateField.localDateTimeToDate(startTime).getTime()
                    : CmsLoginMessage.DEFAULT_TIME_START));
        m_formBinderBefore = new Binder<>();
        m_formBinderBefore.bind(m_messageBefore, CmsLoginMessage::getMessage, CmsLoginMessage::setMessage);

        m_formBinderBefore.bind(
            m_enabledBefore,
            loginMessage -> Boolean.valueOf(loginMessage.isEnabled()),
            (loginMessage, enabled) -> loginMessage.setEnabled(enabled.booleanValue()));
    }
522839
@SuppressWarnings("unchecked")
    public static <M extends PMessage<M,F>, F extends PField, B extends PMessageBuilder<M,F>>
    B mutateIfNotNull(M message) {
        if (message == null) {
            return null;
        }
        return (B) message.mutate();
    }
1346144
private void setField(Object value, Object object, Field f) {
        f.setAccessible(true);

        Object valueToSet = value;
        try {
            // check if field type is enum
            if (Enum.class.isAssignableFrom(f.getType())) {
                Enum v = Enum.valueOf((Class<Enum>) f.getType(), String.valueOf(value));
                valueToSet = v;
            }
            f.set(object, valueToSet);
        } catch (Exception e) {
            throw new RuntimeException(e.getMessage(), e);
        }
    }
1034129
public static Optional<Class> resolveGenericTypeArgument(Field field) {
        Type genericType = field != null ? field.getGenericType() : null;
        if (genericType instanceof ParameterizedType) {
            Type[] typeArguments = ((ParameterizedType) genericType).getActualTypeArguments();
            if (typeArguments.length > 0) {
                Type typeArg = typeArguments[0];
                return resolveParameterizedTypeArgument(typeArg);
            }
        }
        return Optional.empty();
    }
711245
def field(self, type, field, default=None):
        ''''''
        if not type in self.messages:
            return default
        return getattr(self.messages[type], field, default)
750300
FieldBuilder getFieldBuilder(Element element) {
        FieldBuilder fieldBuilder = new FieldBuilder(messager, element);
        fieldBuilder.setBindingManager(this);
        return fieldBuilder;
    }
1219143
public CodePage getCodePage(int field)
   {
      CodePage result;

      if ((field < m_fields.length) && (m_fields[field].length() != 0))
      {
         result = CodePage.getInstance(m_fields[field]);
      }
      else
      {
         result = CodePage.getInstance(null);
      }

      return (result);
   }
333508
public Class<?> getActualFieldType(final String field) {
        
        final Object fieldValue = getFieldValue(field);
        return fieldValue == null ? null : fieldValue.getClass();
        
    }
1123112
protected JsonObject paramError(String field, String message) {
        Map<String, Object> errors = new HashMap<String, Object>();
        errors.put(field, message);
        return paramError(errors);
    }