List of usage examples for com.google.gwt.core.ext.typeinfo JMethod isDefaultAccess
boolean isDefaultAccess();
From source file:com.github.nmorel.gwtjackson.rebind.property.PropertyProcessor.java
License:Apache License
private static boolean isGetterAutoDetected(RebindConfiguration configuration, PropertyAccessors propertyAccessors, BeanInfo info) { if (!propertyAccessors.getGetter().isPresent()) { return false; }// w w w . j a va 2s . com for (Class<? extends Annotation> annotation : AUTO_DISCOVERY_ANNOTATIONS) { if (propertyAccessors.isAnnotationPresentOnGetter(annotation)) { return true; } } JMethod getter = propertyAccessors.getGetter().get(); String methodName = getter.getName(); JsonAutoDetect.Visibility visibility; if (methodName.startsWith("is") && methodName.length() > 2 && JPrimitiveType.BOOLEAN.equals(getter.getReturnType().isPrimitive())) { // getter method for a boolean visibility = info.getIsGetterVisibility(); if (Visibility.DEFAULT == visibility) { visibility = configuration.getDefaultIsGetterVisibility(); } } else if (methodName.startsWith("get") && methodName.length() > 3) { visibility = info.getGetterVisibility(); if (Visibility.DEFAULT == visibility) { visibility = configuration.getDefaultGetterVisibility(); } } else { // no annotation on method and the method does not follow naming convention return false; } return isAutoDetected(visibility, getter.isPrivate(), getter.isProtected(), getter.isPublic(), getter.isDefaultAccess()); }
From source file:com.github.nmorel.gwtjackson.rebind.property.PropertyProcessor.java
License:Apache License
private static boolean isSetterAutoDetected(RebindConfiguration configuration, PropertyAccessors propertyAccessors, BeanInfo info) { if (!propertyAccessors.getSetter().isPresent()) { return false; }/* w w w . jav a 2 s.co m*/ 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()); }
From source file:rocket.generator.rebind.gwt.JMethodMethodAdapter.java
License:Apache License
protected Visibility createVisibility() { Visibility visibility = null; while (true) { final JMethod method = this.getJMethod(); if (method.isPrivate()) { visibility = Visibility.PRIVATE; break; }//from w w w . ja v a2s . com if (method.isDefaultAccess()) { visibility = Visibility.PACKAGE_PRIVATE; break; } if (method.isProtected()) { visibility = Visibility.PROTECTED; break; } if (method.isPublic()) { visibility = Visibility.PUBLIC; break; } Checker.fail("Unknown visibility for field " + method); } return visibility; }