@Test public void testAbbreviate() { assertEquals("Low", Strings.abbreviate("Low", 10)); assertEquals("Foo ...", Strings.abbreviate("Foo and John", 7)); assertEquals("F...", Strings.abbreviate("Foooo", 4)); }
static String abbreviate(String value, int limit) { if (limit < ABR_MIN_LIMIT) { throw new IllegalArgumentException("Minimum limit is 4"); } if (value == null || value.length() <= limit) { return value; } return value.substring(0, limit - ABR_MARKER.length()) + ABR_MARKER; }
Strings { static String abbreviate(String value, int limit) { if (limit < ABR_MIN_LIMIT) { throw new IllegalArgumentException("Minimum limit is 4"); } if (value == null || value.length() <= limit) { return value; } return value.substring(0, limit - ABR_MARKER.length()) + ABR_MARKER; } }
Strings { static String abbreviate(String value, int limit) { if (limit < ABR_MIN_LIMIT) { throw new IllegalArgumentException("Minimum limit is 4"); } if (value == null || value.length() <= limit) { return value; } return value.substring(0, limit - ABR_MARKER.length()) + ABR_MARKER; } private  Strings(); }
Strings { static String abbreviate(String value, int limit) { if (limit < ABR_MIN_LIMIT) { throw new IllegalArgumentException("Minimum limit is 4"); } if (value == null || value.length() <= limit) { return value; } return value.substring(0, limit - ABR_MARKER.length()) + ABR_MARKER; } private  Strings();  }
Strings { static String abbreviate(String value, int limit) { if (limit < ABR_MIN_LIMIT) { throw new IllegalArgumentException("Minimum limit is 4"); } if (value == null || value.length() <= limit) { return value; } return value.substring(0, limit - ABR_MARKER.length()) + ABR_MARKER; } private  Strings();  static final String ID; static final String BDA_ID; static final String BDA; static final String BEAN_DISCOVERY_MODE; static final String WARNING; static final String EXCLUDE; static final String INCLUDE; static final String ACTIVATIONS; static final String SCAN; static final String BEANS_XML; static final String TRIMMED; static final String URL; static final String MARKER; static final String BDAS; static final String CONFIGURATION; static final String CONFLICTS; static final String SCOPE; static final String TYPES; static final String TYPE; static final String QUALIFIER; static final String QUALIFIERS; static final String NAME; static final String STEREOTYPES; static final String KIND; static final String IS_ALTERNATIVE; static final String EJB_NAME; static final String SESSION_BEAN_TYPE; static final String DEPENDENCIES; static final String DEPENDENTS; static final String DECLARING_BEAN; static final String DISPOSAL_METHOD; static final String PRODUCER_METHOD; static final String PRODUCER_FIELD; static final String PRODUCER_INFO; static final String BEAN_CLASS; static final String BEAN_TYPE; static final String OBSERVED_TYPE; static final String RECEPTION; static final String TX_PHASE; static final String PRIORITY; static final String PRIORITY_RANGE; static final String ANNOTATED_METHOD; static final String VALUE; static final String DEFAULT_VALUE; static final String PROPERTIES; static final String INSTANCES; static final String OBJECT_TO_STRING; static final String AS_STRING; static final String REQUIRED_TYPE; static final String METHOD_NAME; static final String START; static final String TIME; static final String DECLARED_OBSERVERS; static final String DECLARED_PRODUCERS; static final String REMOVED_INVOCATIONS; static final String CHILDREN; static final String INTERCEPTED_BEAN; static final String DECLARING_CLASS; static final String ENABLEMENT; static final String INTERCEPTORS; static final String DECORATORS; static final String ALTERNATIVES; static final String ACCESSIBLE_BDAS; static final String BEANS; static final String SEARCH; static final String TIMESTAMP; static final String CONTEXTS; static final String CIDS; static final String CONTAINER; static final String CONTAINER_EVENT; static final String EVENT_INFO; static final String OBSERVERS; static final String METHOD; static final String CLASS; static final String APPLICATION; static final String CONTEXT_ID; static final String VERSION; static final String PROBE_COMPONENT; static final String DESCRIPTION; static final String INFO; static final String IS_POTENTIAL; static final String IS_UNSATISFIED; static final String IS_AMBIGUOUS; static final String BINDINGS; static final String DELEGATE_TYPE; static final String DELEGATE_QUALIFIERS; static final String DECORATED_TYPES; static final String CLASS_INTERCEPTOR_BINDINGS; static final String ASSOCIATED_TO; static final String REMOVED_EVENTS; static final String INIT_TS; static final String DASHBOARD; static final String BOOSTRAP_STATS; static final String FIRED; static final String INVOCATIONS; static final String RESOLVE; static final String HASH; static final String UNUSED; static final String INVERTED; static final String CLASS_AVAILABILITY; static final String SYS_PROPERTY; static final String PAGE; static final String PAGE_SIZE; static final String TOTAL; static final String LAST_PAGE; static final String DATA; static final String FILTERS; static final String REPRESENTATION; static final String ERROR; static final String PARAM_TRANSIENT_DEPENDENCIES; static final String PARAM_TRANSIENT_DEPENDENTS; }