Java Code Examples for javassist.expr.FieldAccess#getClassName()
The following examples show how to use
javassist.expr.FieldAccess#getClassName() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FieldAccessReplaceTransformer.java From DroidAssist with Apache License 2.0 | 6 votes |
@Override protected boolean execute( CtClass inputClass, String inputClassName, FieldAccess fieldAccess) throws CannotCompileException, NotFoundException { String insnClassName = fieldAccess.getClassName(); String insnSignature = fieldAccess.getSignature(); String insnFieldName = fieldAccess.getFieldName(); if (!isMatchFieldSource(insnClassName, insnSignature, insnFieldName) || !meetConditions(fieldAccess)) { return false; } String target = getTarget(); String replacement = replaceInstrument(fieldAccess, target); Logger.warning(getPrettyName() + " by: " + (fieldAccess.isWriter() ? " write" : " read") + replacement + " at " + inputClassName + ".java" + ":" + fieldAccess.getLineNumber()); return true; }
Example 2
Source File: SourceTargetTransformer.java From DroidAssist with Apache License 2.0 | 5 votes |
protected String getReplaceStatement(FieldAccess fieldAccess, String statement) { int line = fieldAccess.getLineNumber(); String name = fieldAccess.getFieldName(); String className = fieldAccess.getClassName(); String fileName = fieldAccess.getFileName(); return getReplaceStatement(statement, line, name, className, fileName); }
Example 3
Source File: FieldAccessInsertTransformer.java From DroidAssist with Apache License 2.0 | 5 votes |
@Override protected boolean execute( CtClass inputClass, String inputClassName, FieldAccess fieldAccess) throws CannotCompileException, NotFoundException { String insnClassName = fieldAccess.getClassName(); String insnSignature = fieldAccess.getSignature(); String insnFieldName = fieldAccess.getFieldName(); if (!isMatchFieldSource(insnClassName, insnSignature, insnFieldName) || !meetConditions(fieldAccess)) { return false; } String target = getTarget(); String proceed = fieldAccess.isWriter() ? "$proceed($$);" : "$_=$proceed($$);"; String statement = "" + "{" + (isAsBefore() ? target : "") + proceed + (isAsAfter() ? target : "") + "}"; String replacement = replaceInstrument(fieldAccess, statement); Logger.warning(getPrettyName() + " by: " + replacement + " at " + inputClassName + ".java" + ":" + fieldAccess.getLineNumber()); return true; }
Example 4
Source File: FieldAccessAroundTransformer.java From DroidAssist with Apache License 2.0 | 5 votes |
@Override protected boolean execute( CtClass inputClass, String inputClassName, FieldAccess fieldAccess) throws CannotCompileException, NotFoundException { String insnClassName = fieldAccess.getClassName(); String insnSignature = fieldAccess.getSignature(); String insnFieldName = fieldAccess.getFieldName(); if (!isMatchFieldSource(insnClassName, insnSignature, insnFieldName) || !meetConditions(fieldAccess)) { return false; } String before = getTargetBefore(); String after = getTargetAfter(); String proceed = fieldAccess.isWriter() ? "$proceed($$);" : "$_=$proceed($$);"; String statement = "{" + before + proceed + after + "}"; String replacement = replaceInstrument(fieldAccess, statement); Logger.warning(getPrettyName() + " by: " + replacement + " at " + inputClassName + ".java" + ":" + fieldAccess.getLineNumber()); return true; }