final MethodAppearanceDecision decision = new MethodAppearanceDecision(); MethodAppearanceDecisionInput decisionInput = null; List<MethodDescriptor> mds = getMethodDescriptors(beanInfo, clazz); final Method method = getMatchingAccessibleMethod(mds.get(i).getMethod(), accessibleMethods); if (method != null && isAllowedToExpose(method)) { decision.setDefaults(method); if (methodAppearanceFineTuner != null) { if (decisionInput == null) { PropertyDescriptor propDesc = decision.getExposeAsProperty(); if (propDesc != null && (decision.getReplaceExistingProperty() || !(introspData.get(propDesc.getName()) instanceof FastPropertyDescriptor))) { addPropertyDescriptorToClassIntrospectionData( String methodKey = decision.getExposeMethodAs(); if (methodKey != null) { Object previous = introspData.get(methodKey); } else if (decision.getMethodShadowsProperty() || !(previous instanceof FastPropertyDescriptor)) {
MethodAppearanceDecision decision = new MethodAppearanceDecision(); for(int i = mda.length - 1; i >= 0; --i) if(publicMethod != null && isSafeMethod(publicMethod)) decision.setDefaults(publicMethod); finetuneMethodAppearance(clazz, publicMethod, decision); PropertyDescriptor propDesc = decision.getExposeAsProperty(); if (propDesc != null && !(classMap.get(propDesc.getName()) String methodKey = decision.getExposeMethodAs(); if (methodKey != null) else if (decision.getMethodShadowsProperty() || !(previous instanceof PropertyDescriptor))
final MethodAppearanceDecision decision = new MethodAppearanceDecision(); MethodAppearanceDecisionInput decisionInput = null; List<MethodDescriptor> mds = getMethodDescriptors(beanInfo, clazz); final Method method = getMatchingAccessibleMethod(mds.get(i).getMethod(), accessibleMethods); if (method != null && isAllowedToExpose(method)) { decision.setDefaults(method); if (methodAppearanceFineTuner != null) { if (decisionInput == null) { PropertyDescriptor propDesc = decision.getExposeAsProperty(); if (propDesc != null && (decision.getReplaceExistingProperty() || !(introspData.get(propDesc.getName()) instanceof FastPropertyDescriptor))) { addPropertyDescriptorToClassIntrospectionData( String methodKey = decision.getExposeMethodAs(); if (methodKey != null) { Object previous = introspData.get(methodKey); } else if (decision.getMethodShadowsProperty() || !(previous instanceof FastPropertyDescriptor)) {
final MethodAppearanceDecision decision = new MethodAppearanceDecision(); MethodAppearanceDecisionInput decisionInput = null; List<MethodDescriptor> mds = getMethodDescriptors(beanInfo, clazz); final Method method = getMatchingAccessibleMethod(mds.get(i).getMethod(), accessibleMethods); if (method != null && isAllowedToExpose(method)) { decision.setDefaults(method); if (methodAppearanceFineTuner != null) { if (decisionInput == null) { PropertyDescriptor propDesc = decision.getExposeAsProperty(); if (propDesc != null && (decision.getReplaceExistingProperty() || !(introspData.get(propDesc.getName()) instanceof FastPropertyDescriptor))) { addPropertyDescriptorToClassIntrospectionData( String methodKey = decision.getExposeMethodAs(); if (methodKey != null) { Object previous = introspData.get(methodKey); } else if (decision.getMethodShadowsProperty() || !(previous instanceof FastPropertyDescriptor)) {
@Override public void process(MethodAppearanceDecisionInput methodAppearanceDecisionInput, MethodAppearanceDecision methodAppearanceDecision) { Method method = methodAppearanceDecisionInput.getMethod(); // How to define a setter? This is a weak approximation: a method whose name // starts with "set" or returns void. if ( method.getName().startsWith("set") ) { methodAppearanceDecision.setExposeMethodAs(null); } else if ( method.getReturnType().getName().equals("void") ) { methodAppearanceDecision.setExposeMethodAs(null); } else { Class<?> declaringClass = method.getDeclaringClass(); if (declaringClass.equals(java.lang.Object.class)) { methodAppearanceDecision.setExposeMethodAs(null); } else { Package pkg = declaringClass.getPackage(); if (pkg.getName().equals("java.util")) { methodAppearanceDecision.setExposeMethodAs(null); } } } } });
@SuppressWarnings("rawtypes") @Override protected void finetuneMethodAppearance(Class cls, Method method, MethodAppearanceDecision decision) { try { String methodName = method.getName(); if (!(methodName.equals("add") || methodName.equals("list"))) { decision.setExposeMethodAs(null); } } catch (Exception e) { log.error(e, e); } } }