/** * Returns whether the given method is a 'getter' method. * * @param method a parameterless method that returns a non-void * @return the property name */ protected String isGetter(final Method<?, ?> method) { String methodName = method.getName(); String propertyName; if (methodName.startsWith(ClassUtils.JAVABEAN_GET_PREFIX)) { propertyName = methodName.substring(ClassUtils.JAVABEAN_GET_PREFIX.length()); } else if (methodName.startsWith(ClassUtils.JAVABEAN_IS_PREFIX) && method.getReturnType() != null && boolean.class.equals(method.getReturnType().getQualifiedName())) { // As per section 8.3.2 (Boolean properties) of The JavaBeans API specification, 'is' // only applies to boolean (little 'b') propertyName = methodName.substring(ClassUtils.JAVABEAN_IS_PREFIX.length()); } else { return null; } return StringUtils.decapitalize(propertyName); }
/** * Returns whether the given method is a 'getter' method. * * @param method a parameterless method that returns a non-void * @return the property name */ protected String isGetter(final Method<?, ?> method) { String methodName = method.getName(); String propertyName; if (methodName.startsWith(ClassUtils.JAVABEAN_GET_PREFIX)) { propertyName = methodName.substring(ClassUtils.JAVABEAN_GET_PREFIX.length()); } else if (methodName.startsWith(ClassUtils.JAVABEAN_IS_PREFIX) && method.getReturnType() != null && boolean.class.equals(method.getReturnType().getQualifiedName())) { // As per section 8.3.2 (Boolean properties) of The JavaBeans API specification, 'is' // only applies to boolean (little 'b') propertyName = methodName.substring(ClassUtils.JAVABEAN_IS_PREFIX.length()); } else { return null; } return StringUtils.decapitalize(propertyName); }
@Override public String getGenericType() { if (this.readMethod != null) { @SuppressWarnings({ "unchecked", "rawtypes" }) List<Type<?>> typeArguments = (List) this.readMethod.getReturnType().getTypeArguments(); if (!typeArguments.isEmpty()) { return typeArguments.get(0).getQualifiedName(); } } if (this.privateField != null) { @SuppressWarnings({ "unchecked", "rawtypes" }) List<Type<?>> typeArguments = (List) this.privateField.getType().getTypeArguments(); if (!typeArguments.isEmpty()) { return typeArguments.get(0).getQualifiedName(); } } return null; }
@Override public String getGenericType() { if (this.readMethod != null) { @SuppressWarnings({ "unchecked", "rawtypes" }) List<Type<?>> typeArguments = (List) this.readMethod.getReturnType().getTypeArguments(); if (!typeArguments.isEmpty()) { return typeArguments.get(0).getQualifiedName(); } } if (this.privateField != null) { @SuppressWarnings({ "unchecked", "rawtypes" }) List<Type<?>> typeArguments = (List) this.privateField.getType().getTypeArguments(); if (!typeArguments.isEmpty()) { return typeArguments.get(0).getQualifiedName(); } } return null; }
if (member instanceof Method) type = ((Method<?, ?>) member).getReturnType().getQualifiedName(); if (name.startsWith("get")) && (method.getReturnType() != null && type.equals(method.getReturnType().getQualifiedName())))
String returnType = method.getReturnType() != null ? method.getReturnType().getQualifiedName() : null;
String returnType = method.getReturnType() != null ? method.getReturnType().getQualifiedName() : null;
public static String resolveIdType(JavaClass<?> entity) { for (Member<?> member : entity.getMembers()) { if (member.hasAnnotation(Id.class)) { if (member instanceof Method) { return ((Method<?, ?>) member).getReturnType().getName(); } if (member instanceof Field) { return ((Field<?>) member).getType().getName(); } } } return "Object"; } }
private boolean isAccessor(Method<O, ?> method) { if (method.isConstructor()) { return false; } if (method.isReturnTypeVoid()) { return false; } if (method.getParameters().isEmpty()) { if (method.getReturnType().isType(boolean.class) && Strings.areEqual(method.getName(), methodName("is", name))) { return true; } return Strings.areEqual(method.getName(), methodName("get", name)); } return false; }
private boolean isAccessor(Method<O, ?> method) { if (method.isConstructor()) { return false; } if (method.isReturnTypeVoid()) { return false; } if (method.getParameters().isEmpty()) { if (method.getReturnType().isType(boolean.class) && Strings.areEqual(method.getName(), methodName("is", name))) { return true; } return Strings.areEqual(method.getName(), methodName("get", name)); } return false; }
private boolean isAccessor(Method<O, ?> method) { if (method.isConstructor()) { return false; } if (method.isReturnTypeVoid()) { return false; } if (method.getParameters().isEmpty()) { if (method.getReturnType().isType(boolean.class) && Strings.areEqual(method.getName(), methodName("is", name))) { return true; } return Strings.areEqual(method.getName(), methodName("get", name)); } return false; }
if (method.getReturnType() != null) { returnType = new org.kie.workbench.common.services.datamodeller.core.impl.TypeImpl( resolveTypeName(classTypeResolver, method.getReturnType().getName()), resolveTypeArguments(method.getReturnType().getTypeArguments()));