Package org.springframework.core.enums

Examples of org.springframework.core.enums.LabeledEnum


     *      org.springframework.enums.LabeledEnum)
     */
    public void setLabeledEnum(String key, LabeledEnum value) {
        Assert.notNull(key, "Key cannot be null");

        LabeledEnum old = getLabeledEnum(key);
        internalSet(key, enumToString(value));
        afterSet(key, old, value);
    }
View Full Code Here


        assertEquals( 0, propertyChangeListener.getCount() );
    }

    public final void testEnum() {
        String key = "enum-value";
        LabeledEnum defaultValue = null;
        LabeledEnum newValue = TestEnum.ENUM2;

        // default value
        assertEquals( defaultValue, settings.getLabeledEnum( key ) );
        assertEquals( defaultValue, settings.getDefaultLabeledEnum( key ) );
        assertTrue( settings.isDefault( key ) );
View Full Code Here

  private static boolean exhaustiveCompare(
      Object boundValue, Object candidate, PropertyEditor editor, Map convertedValueCache) {

    String candidateDisplayString = ValueFormatter.getDisplayString(candidate, editor, false);
    if (boundValue instanceof LabeledEnum) {
      LabeledEnum labeledEnum = (LabeledEnum) boundValue;
      String enumCodeAsString = ObjectUtils.getDisplayString(labeledEnum.getCode());
      if (enumCodeAsString.equals(candidateDisplayString)) {
        return true;
      }
      String enumLabelAsString = ObjectUtils.getDisplayString(labeledEnum.getLabel());
      if (enumLabelAsString.equals(candidateDisplayString)) {
        return true;
      }
    }
    else if (JdkVersion.isAtLeastJava15() && boundValue.getClass().isEnum()) {
View Full Code Here

  protected Object toObject(String string, Class targetClass) throws Exception {
    return labeledEnumResolver.getLabeledEnumByLabel(targetClass, string);
  }

  protected String toString(Object object) throws Exception {
    LabeledEnum labeledEnum = (LabeledEnum) object;
    return labeledEnum.getLabel();
  }
View Full Code Here

  private static boolean exhaustiveCompare(Object boundValue, Object candidate,
      PropertyEditor editor, Map<PropertyEditor, Object> convertedValueCache) {

    String candidateDisplayString = ValueFormatter.getDisplayString(candidate, editor, false);
    if (boundValue instanceof LabeledEnum) {
      LabeledEnum labeledEnum = (LabeledEnum) boundValue;
      String enumCodeAsString = ObjectUtils.getDisplayString(labeledEnum.getCode());
      if (enumCodeAsString.equals(candidateDisplayString)) {
        return true;
      }
      String enumLabelAsString = ObjectUtils.getDisplayString(labeledEnum.getLabel());
      if (enumLabelAsString.equals(candidateDisplayString)) {
        return true;
      }
    }
    else if (boundValue.getClass().isEnum()) {
View Full Code Here

  private static boolean exhaustiveCompare(
      Object boundValue, Object candidate, PropertyEditor editor, Map convertedValueCache) {

    String candidateDisplayString = ValueFormatter.getDisplayString(candidate, editor, false);
    if (boundValue instanceof LabeledEnum) {
      LabeledEnum labeledEnum = (LabeledEnum) boundValue;
      String enumCodeAsString = ObjectUtils.getDisplayString(labeledEnum.getCode());
      if (enumCodeAsString.equals(candidateDisplayString)) {
        return true;
      }
      String enumLabelAsString = ObjectUtils.getDisplayString(labeledEnum.getLabel());
      if (enumLabelAsString.equals(candidateDisplayString)) {
        return true;
      }
    }
    else if (JdkVersion.isAtLeastJava15() && boundValue.getClass().isEnum()) {
View Full Code Here

  private static boolean exhaustiveCompare(
      Object boundValue, Object candidate, PropertyEditor propertyEditor, Map convertedValueCache) {

    String candidateDisplayString = ValueFormatter.getDisplayString(candidate, propertyEditor, false);
    if (boundValue instanceof LabeledEnum) {
      LabeledEnum labeledEnum = (LabeledEnum) boundValue;
      String enumCodeAsString = ObjectUtils.getDisplayString(labeledEnum.getCode());
      if (enumCodeAsString.equals(candidateDisplayString)) {
        return true;
      }
      String enumLabelAsString = ObjectUtils.getDisplayString(labeledEnum.getLabel());
      if (enumLabelAsString.equals(candidateDisplayString)) {
        return true;
      }
    }
    else if (JdkVersion.isAtLeastJava15() && boundValue.getClass().isEnum()) {
View Full Code Here

     *      org.springframework.enums.LabeledEnum)
     */
    public void setLabeledEnum( String key, LabeledEnum value ) {
        Assert.notNull( key, "Key cannot be null" );

        LabeledEnum old = getLabeledEnum( key );
        internalSet( key, enumToString( value ) );
        afterSet( key, old, value );
    }
View Full Code Here

  private static boolean exhaustiveCompare(Object boundValue, Object candidate,
      PropertyEditor editor, Map<PropertyEditor, Object> convertedValueCache) {

    String candidateDisplayString = ValueFormatter.getDisplayString(candidate, editor, false);
    if (boundValue instanceof LabeledEnum) {
      LabeledEnum labeledEnum = (LabeledEnum) boundValue;
      String enumCodeAsString = ObjectUtils.getDisplayString(labeledEnum.getCode());
      if (enumCodeAsString.equals(candidateDisplayString)) {
        return true;
      }
      String enumLabelAsString = ObjectUtils.getDisplayString(labeledEnum.getLabel());
      if (enumLabelAsString.equals(candidateDisplayString)) {
        return true;
      }
    }
    else if (boundValue.getClass().isEnum()) {
View Full Code Here

TOP

Related Classes of org.springframework.core.enums.LabeledEnum

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.