private SetKey findSetKey(ElementDescriptor parent, TypeDescriptor elementType) { SetKey setKey = null; if (parent != null) { setKey = parent.getAnnotation(SetKey.class); } if (setKey == null) { setKey = elementType.getAnnotation(SetKey.class); } return setKey; }
private boolean acceptIdProperty(BeanProperty property) { return property.isReadable() && property.getReadMethod().hasAnnotation(Id.class); }
public String getName() { Param param = getAnnotation(Param.class); if (param != null) { return param.value(); } if (parameter.isNamePresent()) { return parameter.getName(); } Paranamer paranamer = getTypeDescriptors().getParanamer(); String[] names = paranamer.lookupParameterNames(getAccessibleObject()); return names.length > index ? names[index] : "arg" + index; }
private boolean acceptField(FieldDescriptor fieldDescriptor) { return !fieldDescriptor.isTransient() && !fieldDescriptor.isStatic() && !fieldDescriptor.isSynthetic() && !fieldDescriptor.hasAnnotation(VersionIgnore.class); }
@Override public TypeDescriptor getType() { if (readMethod != null) { return readMethod.getReturnType(); } else { return writeMethod.getParameters().get(0).getType(); } }
TypeDescriptor getTypeDescriptor(TypeToken typeToken) { return getTypeDescriptors().get(typeToken); }
@Override public boolean applies(PropertyPath path, TypeContext typeContext) { return typeContext.type.isSubTypeOf(Instant.class); }
public Object get(Object obj) { try { return field.get(obj); } catch (IllegalAccessException e) { throw new ReflectionException(toString(), e); } }
public Object invoke(Object object, Object... args) { try { return method.invoke(object, args); } catch (IllegalAccessException | InvocationTargetException e) { throw new ReflectionException(toString(), e); } }
public Object newInstance(Object... args) { try { return constructor.newInstance(args); } catch (InstantiationException | InvocationTargetException | IllegalAccessException e) { throw new ReflectionException(toString(), e); } }
public TypeDescriptor getDeclaringType() { if (readMethod != null) { return readMethod.getDeclaringType(); } else { return writeMethod.getDeclaringType(); } }
@Override public Object invokeStatic(Object... args) { return newInstance(args); }
@Override public boolean applies(PropertyPath path, TypeContext typeContext) { return typeContext.type.isEnum(); }
@Override public String toString() { return methodDescriptor.toString(index); }
@Override public boolean isWritableFrom(TypeDescriptor typeDescriptor) { return writeMethod != null && writeMethod.applies(typeDescriptor); }
private boolean acceptProperty(BeanProperty property) { return property.isReadable() && property.getReadMethod().hasAnnotation(VersionProperty.class); }
@Override public boolean applies(PropertyPath path, TypeContext typeContext) { return typeContext.type.isSubTypeOf(LocalDate.class); }
public void set(Object obj, Object value) { try { field.set(obj, value); } catch (IllegalArgumentException | IllegalAccessException e) { throw new ReflectionException(toString(), e); } }
@Override public boolean applies(PropertyPath path, TypeContext typeContext) { return typeContext.type.isSubTypeOf(DateTime.class); }