@Test public void toEnumNameNull() { Assert.assertNull( NameUtils.toEnumName( null ) ); }
@Nullable public static String toEnumName( @Nullable Object value ) { if ( value == null ) { return null; } final String stringValue = value.toString(); if ( stringValue == null ) { return null; } if ( stringValue.length() == 0 ) { return stringValue; } if ( containsNoLowerCase( stringValue ) ) { return stringValue.replace( '-', '_' ); } return Arrays.stream( StringUtils.splitByCharacterTypeCamelCase( stringValue.replace( '-', '_' ) ) ) .filter( v -> !v.equals( "_" ) ).collect( Collectors.joining( "_" ) ).toUpperCase(); }
NameUtils { @Nullable public static String toEnumName( @Nullable Object value ) { if ( value == null ) { return null; } final String stringValue = value.toString(); if ( stringValue == null ) { return null; } if ( stringValue.length() == 0 ) { return stringValue; } if ( containsNoLowerCase( stringValue ) ) { return stringValue.replace( '-', '_' ); } return Arrays.stream( StringUtils.splitByCharacterTypeCamelCase( stringValue.replace( '-', '_' ) ) ) .filter( v -> !v.equals( "_" ) ).collect( Collectors.joining( "_" ) ).toUpperCase(); } }
NameUtils { @Nullable public static String toEnumName( @Nullable Object value ) { if ( value == null ) { return null; } final String stringValue = value.toString(); if ( stringValue == null ) { return null; } if ( stringValue.length() == 0 ) { return stringValue; } if ( containsNoLowerCase( stringValue ) ) { return stringValue.replace( '-', '_' ); } return Arrays.stream( StringUtils.splitByCharacterTypeCamelCase( stringValue.replace( '-', '_' ) ) ) .filter( v -> !v.equals( "_" ) ).collect( Collectors.joining( "_" ) ).toUpperCase(); } private  NameUtils(); }
NameUtils { @Nullable public static String toEnumName( @Nullable Object value ) { if ( value == null ) { return null; } final String stringValue = value.toString(); if ( stringValue == null ) { return null; } if ( stringValue.length() == 0 ) { return stringValue; } if ( containsNoLowerCase( stringValue ) ) { return stringValue.replace( '-', '_' ); } return Arrays.stream( StringUtils.splitByCharacterTypeCamelCase( stringValue.replace( '-', '_' ) ) ) .filter( v -> !v.equals( "_" ) ).collect( Collectors.joining( "_" ) ).toUpperCase(); } private  NameUtils(); @Nullable static String toClassName( @Nullable Object value ); @Nonnull static T toEnumValue( @Nonnull Class<T> enumClass, @Nullable Object value ); @Nullable static T toEnumValue( @Nonnull Class<T> enumClass, @Nullable String value ); @Nullable static String toEnumName( @Nullable Object value ); }
NameUtils { @Nullable public static String toEnumName( @Nullable Object value ) { if ( value == null ) { return null; } final String stringValue = value.toString(); if ( stringValue == null ) { return null; } if ( stringValue.length() == 0 ) { return stringValue; } if ( containsNoLowerCase( stringValue ) ) { return stringValue.replace( '-', '_' ); } return Arrays.stream( StringUtils.splitByCharacterTypeCamelCase( stringValue.replace( '-', '_' ) ) ) .filter( v -> !v.equals( "_" ) ).collect( Collectors.joining( "_" ) ).toUpperCase(); } private  NameUtils(); @Nullable static String toClassName( @Nullable Object value ); @Nonnull static T toEnumValue( @Nonnull Class<T> enumClass, @Nullable Object value ); @Nullable static T toEnumValue( @Nonnull Class<T> enumClass, @Nullable String value ); @Nullable static String toEnumName( @Nullable Object value );  }