private static String getREntityIdFieldName(Object o) throws Exception { return Introspectior .getFieldsWithAnnotation(o.getClass().getSuperclass(), RId.class) .getOnly() .getName(); }
private static String getREntityIdFieldName(Object o) throws Exception { return Introspectior .getFieldsWithAnnotation(o.getClass().getSuperclass(), RId.class) .getOnly() .getName(); }
private String getRIdFieldName(Class<?> cls) { return Introspectior.getFieldsWithAnnotation(cls, RId.class) .getOnly() .getName(); }
private String getRIdFieldName(Class<?> cls) { return Introspectior.getFieldsWithAnnotation(cls, RId.class) .getOnly() .getName(); }
public static FieldDescription getFieldDescription(Class<?> c, String field) { if (field == null || field.isEmpty()) { return null; } return getTypeDescription(c) .getDeclaredFields() .filter(ElementMatchers.named(field)) .getOnly(); }
/** * Creates an accessor to read an enumeration value. * * @param enumerationDescription The description of the enumeration. * @return A stack manipulation for reading the enumeration. */ public static StackManipulation forEnumeration(EnumerationDescription enumerationDescription) { FieldList<FieldDescription.InDefinedShape> fieldList = enumerationDescription.getEnumerationType() .getDeclaredFields() .filter(named(enumerationDescription.getValue())); return fieldList.size() != 1 || !fieldList.getOnly().isStatic() || !fieldList.getOnly().isPublic() || !fieldList.getOnly().isEnum() ? StackManipulation.Illegal.INSTANCE : STATIC.new AccessDispatcher(fieldList.getOnly()).read(); }
/** * {@inheritDoc} */ protected FieldDescription.InDefinedShape initialize(TypeDescription instrumentedType) { return instrumentedType.getDeclaredFields().filter(named(name)).getOnly(); }
public static FieldDescription getFieldDescription(Class<?> c, String field) { if (field == null || field.isEmpty()) { return null; } return getTypeDescription(c) .getDeclaredFields() .filter(ElementMatchers.named(field)) .getOnly(); }
/** * {@inheritDoc} */ public Target resolve(TypeDescription instrumentedType, MethodDescription instrumentedMethod, Assigner assigner, Advice.ArgumentHandler argumentHandler, Sort sort) { return new Target.ForField.ReadWrite(instrumentedType.getDeclaredFields().filter(named(name)).getOnly()); } }
/** * Creates a new appender. * * @param implementationTarget The current implementation target. */ protected Appender(Target implementationTarget) { fieldDescription = implementationTarget.getInstrumentedType() .getDeclaredFields() .filter((named(RedirectionProxy.FIELD_NAME))) .getOnly(); }
/** * Creates a new appender. * * @param implementationTarget The implementation target of the current implementation. */ protected Appender(Target implementationTarget) { fieldDescription = implementationTarget.getInstrumentedType() .getDeclaredFields() .filter((named(AccessorProxy.FIELD_NAME))) .getOnly(); }
/** * {@inheritDoc} */ public ArgumentProvider make(Implementation.Target implementationTarget) { return new ForInstance(implementationTarget.getInstrumentedType().getDeclaredFields().filter(named(name)).getOnly()); } }
/** * Creates a new byte code appender for returning a value of a static field from an instrumented method. * * @param instrumentedType The instrumented type that is subject of the instrumentation. */ private StaticFieldByteCodeAppender(TypeDescription instrumentedType) { fieldGetAccess = FieldAccess.forField(instrumentedType.getDeclaredFields().filter((named(fieldName))).getOnly()).read(); }
/** * Creates a new appender. * * @param instrumentedType The instrumented type that is proxied by the enclosing instrumentation. */ protected Appender(TypeDescription instrumentedType) { fieldLoadingInstruction = FieldAccess.forField(instrumentedType.getDeclaredFields().filter((named(INSTANCE_FIELD))).getOnly()).read(); }
/** * {@inheritDoc} */ public TargetHandler make(Implementation.Target implementationTarget) { return new ForValue(implementationTarget.getInstrumentedType().getDeclaredFields().filter(named(name)).getOnly()); } }
/** * {@inheritDoc} */ public Resolution locate(String name) { FieldList<?> candidates = locate(named(name).and(isVisibleTo(accessingType))); return candidates.size() == 1 ? new Resolution.Simple(candidates.getOnly()) : Resolution.Illegal.INSTANCE; }
@Override protected FieldDescription resolve(TypeDescription instrumentedType) { if (!fieldType.asErasure().isVisibleTo(instrumentedType)) { throw new IllegalStateException(fieldType + " is not visible to " + instrumentedType); } else { return instrumentedType.getDeclaredFields() .filter(named(fieldName).and(fieldType(fieldType.asErasure()))) .getOnly(); } } }
/** * {@inheritDoc} */ public Size apply(MethodVisitor methodVisitor, Context implementationContext, MethodDescription instrumentedMethod) { return ForInstance.this.apply(methodVisitor, implementationContext, instrumentedMethod, StackManipulation.Trivial.INSTANCE, instrumentedType.getDeclaredFields().filter(named(fieldName).and(genericFieldType(INVOCATION_HANDLER_TYPE))).getOnly()); } }
/** * {@inheritDoc} */ public Resolution locate(String name, TypeDescription type) { FieldList<?> candidates = locate(named(name).and(fieldType(type)).and(isVisibleTo(accessingType))); return candidates.size() == 1 ? new Resolution.Simple(candidates.getOnly()) : Resolution.Illegal.INSTANCE; }
/** * {@inheritDoc} */ public Resolved resolve(TypeDescription instrumentedType, MethodDescription instrumentedMethod, Assigner assigner, Assigner.Typing typing) { FieldDescription fieldDescription = instrumentedType.getDeclaredFields().filter(named(name)).getOnly(); StackManipulation stackManipulation = assigner.assign(fieldDescription.getType(), fieldType.asGenericType(), typing); if (!stackManipulation.isValid()) { throw new IllegalStateException("Cannot assign " + fieldDescription + " to " + fieldType); } return new Resolved.Simple(new StackManipulation.Compound(FieldAccess.forField(fieldDescription).read(), stackManipulation), fieldDescription.getType().asErasure()); }