Java Code Examples for org.apache.commons.lang3.ClassUtils#getSimpleName()
The following examples show how to use
org.apache.commons.lang3.ClassUtils#getSimpleName() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Parameter.java From sailfish-core with Apache License 2.0 | 6 votes |
private String getClassName(Object o) { String possibleType = ClassUtils.getSimpleName(o, null); if(o instanceof IFilter) { IFilter filter = (IFilter) o; if (filter.hasValue()) { possibleType = ClassUtils.getSimpleName(filter.getValue(), null); } } if (o instanceof IMessage) { possibleType = IMessage.class.getSimpleName(); } if (o instanceof List) { List<?> list = (List<?>) o; possibleType = List.class.getSimpleName() + "<" + getClassName(Iterables.get(list, 0, null)) + ">"; } return possibleType; }
Example 2
Source File: JsonMessageConverter.java From sailfish-core with Apache License 2.0 | 6 votes |
private static String getValueClass(Object value, IFieldStructure structure) { if(value instanceof List<?>) { value = Iterables.get((Iterable<?>)value, 0, null); if(value != null || structure != null) { return List.class.getSimpleName() + "<" + getValueClass(value, structure) + ">"; } else { return List.class.getSimpleName() + "<String>"; } } else if(value instanceof IMessage) { return IMessage.class.getSimpleName(); } else { if(structure != null) { if(structure.isComplex()) { return IMessage.class.getSimpleName(); } else { return StringUtils.substringAfterLast(structure.getJavaType().value(), "."); } } else { return ClassUtils.getSimpleName(value, null); } } }
Example 3
Source File: IndexResource.java From ctsms with GNU Lesser General Public License v2.1 | 6 votes |
private static JsonElement createVOInputTypeNode(Class<?> inputType, Type genericType) throws Exception { // no input maps: if (isTerminalType(inputType)) { return new JsonPrimitive(ClassUtils.getSimpleName(inputType)); } else { boolean isCollection = Collection.class.isAssignableFrom(inputType); if (isCollection) { try { inputType = (Class<?>) ((ParameterizedType) genericType).getActualTypeArguments()[0]; } catch (Exception e) { inputType = Object.class; } } Collection<Method> fields = AssociationPath.listMethods(inputType, VO_METHOD_TRANSFILTER); if (isTerminalType(inputType) || fields.size() == 0) { return markMapCollection(new JsonPrimitive(ClassUtils.getSimpleName(inputType)), null, false, isCollection); } else { return markMapCollection(createVONode(fields, true), null, false, isCollection); } } }
Example 4
Source File: StaticUtil.java From sailfish-core with Apache License 2.0 | 5 votes |
public static IFilter countFilter(long line, String column, String condition, Object... args) { Map<String, Object> variables = toMap(args); Object value = eval(line, column, condition, variables); if((value instanceof String || value instanceof Number) && MessageCount.isValidExpression(value.toString())) { return new MessageCountFilter(line, MessageCount.fromString(value.toString())); } else if(value instanceof IKnownBug) { return new KnownBugFilter(line, column, (IKnownBug)value); } else if (value instanceof IFilter) { return (IFilter)value; } throw new MvelException(line, column, "Unsupported value type: " + ClassUtils.getSimpleName(value, null)); }
Example 5
Source File: DefaultProcessor.java From OpenAs2App with BSD 2-Clause "Simplified" License | 5 votes |
public boolean checkActiveModules(List<String> failures) { boolean isHealthy = true; List<ActiveModule> activeModules = getActiveModules(); for (ActiveModule activeModule : activeModules) { if (logger.isTraceEnabled()) { logger.trace("Checking health of module: " + ClassUtils.getSimpleName(activeModule.getClass())); } if (!activeModule.healthcheck(failures)) { isHealthy = false; if (logger.isTraceEnabled()) { logger.trace(ClassUtils.getSimpleName(activeModule.getClass()) + " healthcheck failed."); } } if (!activeModule.isRunning()) { isHealthy = false; String msg = ClassUtils.getSimpleName(activeModule.getClass()) + " is active but not running."; failures.add(msg); if (logger.isTraceEnabled()) { logger.trace(msg); } } } if (logger.isTraceEnabled()) { logger.trace(activeModules.size() + " active module(s) heathy? " + isHealthy); } return isHealthy; }
Example 6
Source File: ComparisonUtil.java From sailfish-core with Apache License 2.0 | 4 votes |
public static Map<String, Object> toMap(ComparisonResult result, boolean expected) { Map<String, Object> map = new LinkedHashMap<>(); if(!expected) { map.put("status", ObjectUtils.defaultIfNull(result.getStatus(), StatusType.NA)); } Object value = expected ? result.getExpected() : result.getActual(); setTypeAndValue(map, value); if(value instanceof IFilter || !result.hasResults()) { return map; } ComparisonResult firstElement = result.getResult("0"); boolean array = firstElement != null; if(array) { String genericType = null; if(firstElement.hasResults()) { genericType = IMessage.class.getSimpleName(); } else { Object firstValue = ObjectUtils.defaultIfNull(firstElement.getActual(), firstElement.getExpected()); genericType = ClassUtils.getSimpleName(firstValue, null); } map.put("type", List.class.getSimpleName() + "<" + genericType + ">"); } else { map.put("type", IMessage.class.getSimpleName()); } if(!expected && result.getExpected() != null && result.getActual() == null) { map.put("value", null); return map; } Map<String, Object> subMap = new LinkedHashMap<>(); for(ComparisonResult subResult : result) { if(expected && subResult.getExpected() == null && subResult.getActual() != null) { continue; } subMap.put(subResult.getName(), toMap(subResult, expected)); } map.put("value", array ? subMap.values() : subMap); return map; }
Example 7
Source File: BaseCommandProcessor.java From OpenAs2App with BSD 2-Clause "Simplified" License | 4 votes |
@Override public String getName() { return ClassUtils.getSimpleName(getClass()); }