public boolean isSubTypeOf(Class<?> clazz) { return clazz.isAssignableFrom(getRawType()); }
@Override public boolean applies(PropertyPath path, TypeContext typeContext) { return path != null && typeContext.type.getRawType().equals(setType); }
@Override public boolean applies(PropertyPath path, TypeContext typeContext) { TypeDescriptor typeDescriptor = typeContext.type; return typeDescriptor.getRawType().equals(type); }
@Override public boolean applies(PropertyPath path, TypeContext typeContext) { return typeContext.type.getRawType().equals(String.class); }
@Override public boolean applies(PropertyPath path, TypeContext typeContext) { return path != null && typeContext.type.getRawType().equals(Collection.class); }
@Override public boolean applies(PropertyPath path, TypeContext typeContext) { return path != null && typeContext.type.getRawType().equals(List.class); }
@Override public boolean applies(PropertyPath path, TypeContext descriptor) { return path != null && descriptor.type.getRawType().equals(mapType); }
public boolean equalTo(Class<?> type) { return getRawType().equals(type); }
public boolean isEnum() { return getRawType().isEnum(); }
public List<Annotation> getAnnotations() { return ImmutableList.copyOf(getRawType().getAnnotations()); }
@Override public boolean applies(PropertyPath path, TypeContext typeContext) { Class<?> clazz = typeContext.type.getRawType(); return wrapperType.equals(clazz) || primitiveType.equals(clazz); }
public boolean isAbstract() { return Modifier.isAbstract(getRawType().getModifiers()); }
public Map<MethodSignature, MethodDescriptor> getMethods() { Map<MethodSignature, MethodDescriptor> result = new HashMap<>(); collectMethods(getRawType(), result); return ImmutableMap.copyOf(result); }
@SuppressWarnings({ "unchecked", "rawtypes" }) @Override public ValueType describe(PropertyPath path, TypeDescriptor type, DescribeContext context) { return new EnumValueType((Class<Enum>) type.getRawType()); }
@Override public ValueType describe(@Nullable PropertyPath path, TypeDescriptor type, DescribeContext context) { return new ToStringValueType(type.getRawType()); }
@Override public boolean applies(@Nullable PropertyPath path, TypeContext typeContext) { TypeDescriptor typeDescriptor = typeContext.type; if (matchSubClasses) { return typeDescriptor.isSubTypeOf(type); } else { return typeDescriptor.getRawType().equals(type); } }
public boolean isSubTypeOf(TypeDescriptor type) { return isSubTypeOf(type.getRawType()); }
public Map<ConstructorSignature, ConstructorDescriptor> getConstructors() { ImmutableMap.Builder<ConstructorSignature, ConstructorDescriptor> result = ImmutableMap.builder(); for (Constructor<?> constructor : getRawType().getDeclaredConstructors()) { if (typeDescriptors.constructorFilter.apply(constructor)) { result.put(new ConstructorSignature(constructor), new ConstructorDescriptor(this, constructor)); } } return result.build(); }
public Object newInstance() { Constructor<?> constructor; try { constructor = getRawType().getDeclaredConstructor(); constructor.setAccessible(true); return constructor.newInstance(); } catch (Exception e) { throw new ReflectionException(toString(), e); } }
public boolean isPrimitiveOrWrapper() { Class<?> clazz = getRawType(); return WRAPPER_TO_PRIMITIVE.containsKey(clazz) || WRAPPER_TO_PRIMITIVE.containsValue(clazz); }