@Override public boolean isPublic() { return method.isPublic(); }
@Override public boolean isPublic() { return method.isPublic(); }
private static boolean isValidCustomFieldSerializerMethod(JMethod method) { if (method == null) { return false; } if (!method.isStatic()) { return false; } if (!method.isPublic()) { return false; } return true; }
private static boolean isValidCustomFieldSerializerMethod(JMethod method) { if (method == null) { return false; } if (!method.isStatic()) { return false; } if (!method.isPublic()) { return false; } return true; }
public static Collection<JMethod> publicMethods(JClassType type) { Collection<JMethod> methods = new ArrayList<JMethod>(); for (JMethod method : type.getMethods()) { if (method.isPublic() && !method.isAbstract() && !method.isStatic()) { methods.add(method); } } return methods; }
private boolean isGetterMethod(final JMethod method, final JPrimitiveType voidType) { return method.isPublic() && method.getParameters().length == 0 && method.getReturnType() != voidType; }
private static boolean isJUnitTestMethod(JMethod m) { return m.isPublic() && m.getName().startsWith("test") && m.getParameters().length == 0 && m.getReturnType().getQualifiedBinaryName().equals(Void.TYPE.getName()); } }
private static boolean isJUnitTestMethod(JMethod m) { return m.isPublic() && m.getName().startsWith("test") && m.getParameters().length == 0 && m.getReturnType().getQualifiedBinaryName().equals(Void.TYPE.getName()); } }
/** * Checks whether the given method qualifies as a setter. This looks at the * method qualifiers, name and return type, but not at the parameter types. * * @param method the method to look at * @return whether it's a setter */ private boolean isSetterMethod(JMethod method) { // All setter methods should be public void setSomething(...) return method.isPublic() && !method.isStatic() && method.getName().startsWith("set") && method.getName().length() > 3 && method.getReturnType() == JPrimitiveType.VOID; }
/** * Checks whether the given method qualifies as a setter. This looks at the * method qualifiers, name and return type, but not at the parameter types. * * @param method the method to look at * @return whether it's a setter */ private boolean isSetterMethod(JMethod method) { // All setter methods should be public void setSomething(...) return method.isPublic() && !method.isStatic() && method.getName().startsWith("set") && method.getName().length() > 3 && method.getReturnType() == JPrimitiveType.VOID; }
private void listGetters(JMethod[] methods) { for (JMethod method : methods) { if (method.getName().startsWith("get") && method.getName().length() > 3 || method.getName().startsWith("is") && method.getName().length() > 2 && method.getParameters().length == 0 && !method.getReturnType().equals(JPrimitiveType.VOID) && method.isPublic()) { this.getters.put(this.extractPropertyNameFromMethod(method), method); this.propertyTypes.put(this.extractPropertyNameFromMethod(method), method.getReturnType()); this.addImport(method.getReturnType()); } } }
private void listGetters(JMethod[] methods) { for (JMethod method : methods) { if (method.getName().startsWith("get") && method.getName().length() > 3 || method.getName().startsWith("is") && method.getName().length() > 2 && method.getParameters().length == 0 && !method.getReturnType().equals(JPrimitiveType.VOID) && method.isPublic()) { this.getters.put(this.extractPropertyNameFromMethod(method), method); this.propertyTypes.put(this.extractPropertyNameFromMethod(method), method.getReturnType()); this.addImport(method.getReturnType()); } } }
private void listSetters(JMethod[] methods) { for (JMethod method : methods) { if (method.getName().startsWith("set") && method.getParameters().length == 1 && method.getReturnType().equals(JPrimitiveType.VOID) && method.isPublic()) { this.setters.put(this.extractPropertyNameFromMethod(method), method); this.propertyTypes.put(this.extractPropertyNameFromMethod(method), method.getParameters()[0].getType()); this.addImport(method.getParameters()[0].getType()); } } }
protected void addSetters(JClassType cls, List<JMethod> methods) { if (cls.getSuperclass() != null) { addSetters(cls.getSuperclass(), methods); } for (JMethod m : cls.getMethods()) { if (m.isPublic() || m.isProtected()) { String name = m.getName(); if (name.matches("set.*") && m.getParameters().length == 1) { methods.add(m); } } } }
private void listSetters(JMethod[] methods) { for (JMethod method : methods) { if (method.getName().startsWith("set") && method.getParameters().length == 1 && method.getReturnType().equals(JPrimitiveType.VOID) && method.isPublic()) { this.setters.put(this.extractPropertyNameFromMethod(method), method); this.propertyTypes.put(this.extractPropertyNameFromMethod(method), method.getParameters()[0].getType()); this.addImport(method.getParameters()[0].getType()); } } }
protected void addGetters(JClassType cls, List<JMethod> methods) { if (cls == null) { return; } // ignore methods of Object if (cls.isInterface() != null || cls.getSuperclass() != null) { addGetters(cls.getSuperclass(), methods); for (JMethod m : cls.getMethods()) { if (m.isPublic() || m.isProtected()) { String name = m.getName(); if ((name.matches("get.*") || name.matches("is.*")) && m.getParameters().length == 0) { methods.add(m); } } } } }
private static boolean isSetterAutoDetected( RebindConfiguration configuration, PropertyAccessors propertyAccessors, BeanInfo info ) { if ( !propertyAccessors.getSetter().isPresent() ) { return false; } for ( Class<? extends Annotation> annotation : AUTO_DISCOVERY_ANNOTATIONS ) { if ( propertyAccessors.isAnnotationPresentOnSetter( annotation ) ) { return true; } } JMethod setter = propertyAccessors.getSetter().get(); String methodName = setter.getName(); if ( !methodName.startsWith( "set" ) || methodName.length() <= 3 ) { // no annotation on method and the method does not follow naming convention return false; } JsonAutoDetect.Visibility visibility = info.getSetterVisibility(); if ( Visibility.DEFAULT == visibility ) { visibility = configuration.getDefaultSetterVisibility(); } return isAutoDetected( visibility, setter.isPrivate(), setter.isProtected(), setter.isPublic(), setter .isDefaultAccess() ); }
/** * <p>getAccessor</p> * * @param beanName a {@link java.lang.String} object. * @param params a {@link java.lang.Object} object. * @return a {@link com.github.nmorel.gwtjackson.rebind.property.FieldAccessor.Accessor} object. */ public Accessor getAccessor( final String beanName, Object... params ) { final boolean useJsni; if ( useMethod ) { useJsni = method.get().isPrivate() || (!samePackage && !method.get().isPublic()); } // else use the field else { useJsni = field.get().isPrivate() || (!samePackage && !field.get().isPublic()); } return getAccessor( beanName, useMethod, useJsni, params ); }
public static int getModifiers(JMethod method) { int mod; if (method.isPublic()) mod = Modifier.PUBLIC; else if (method.isPrivate()) mod = Modifier.PRIVATE; else if (method.isProtected()) mod = Modifier.PROTECTED; else mod = 0;//Package Protected if (method.isFinal()) mod |= Modifier.FINAL; if (method.isStatic()) mod |= Modifier.STATIC; if (method.isVarArgs()) mod |= 0x80;//Modifier.VARARGS; if (method.isAbstract()) mod |= Modifier.ABSTRACT; if (method.isNative()) mod |= Modifier.NATIVE; if (method.isAnnotationMethod()!=null) mod |= 0x2000;//Modifier.ANNOTATION; return mod; }
private void initTokenizerGetters() throws UnableToCompleteException { if (factoryType != null) { // TODO: include non-public methods that are nevertheless accessible // to the interface (package-scoped); // Add a isCallable(JClassType) method to JAbstractMethod? for (JMethod method : factoryType.getInheritableMethods()) { if (!method.isPublic()) { continue; } if (method.getParameters().length > 0) { continue; } JClassType returnType = method.getReturnType().isClassOrInterface(); if (returnType == null) { continue; } if (!placeTokenizerType.isAssignableFrom(returnType)) { continue; } addPlaceTokenizer(method, getPrefixForTokenizerGetter(method), method.getReturnType().isClassOrInterface()); } } }