@Nullable public static DomNameStrategy getDomNameStrategy(final Class<?> rawType, boolean isAttribute) { Class aClass = null; if (isAttribute) { NameStrategyForAttributes annotation = DomReflectionUtil.findAnnotationDFS(rawType, NameStrategyForAttributes.class); if (annotation != null) { aClass = annotation.value(); } } if (aClass == null) { NameStrategy annotation = DomReflectionUtil.findAnnotationDFS(rawType, NameStrategy.class); if (annotation != null) { aClass = annotation.value(); } } if (aClass != null) { if (HyphenNameStrategy.class.equals(aClass)) return DomNameStrategy.HYPHEN_STRATEGY; if (JavaNameStrategy.class.equals(aClass)) return DomNameStrategy.JAVA_STRATEGY; try { return (DomNameStrategy) aClass.newInstance(); } catch (InstantiationException e) { LOG.error(e); } catch (IllegalAccessException e) { LOG.error(e); } } return null; }
public static boolean isGetter(final JavaMethod method) { @NonNls final String name = method.getName(); final boolean isGet = name.startsWith("get"); final boolean isIs = !isGet && name.startsWith("is"); if (!isGet && !isIs) { return false; } if (method.getGenericParameterTypes().length != 0) { return false; } final Type returnType = method.getGenericReturnType(); if (isGet) { return returnType != void.class; } return DomReflectionUtil.canHaveIsPropertyGetterPrefix(returnType); }
@Nullable private static String getNamespaceKey(@NotNull Class<?> type) { final Namespace namespace = DomReflectionUtil.findAnnotationDFS(type, Namespace.class); return namespace != null ? namespace.value() : null; }