Java Code Examples for spoon.reflect.code.CtConstructorCall#getArguments()
The following examples show how to use
spoon.reflect.code.CtConstructorCall#getArguments() .
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: OverloadMethodTransform.java From astor with GNU General Public License v2.0 | 6 votes |
@SuppressWarnings({ "rawtypes", "unchecked" }) @Override public <T> void visitCtConstructorCall(CtConstructorCall<T> ctConstructorCall) { super.visitCtConstructorCall(ctConstructorCall); String type = ctConstructorCall.getType().getQualifiedName(); List<CtExpression<?>> argumentlist = ctConstructorCall.getArguments(); List<String> orig = resolveTypes(argumentlist); CtClass classname = parser.getClassMap().get(type); if(classname!=null) { Set<CtConstructor<T>> constructors=classname.getConstructors(); for(CtConstructor constructor:constructors) { List<CtParameter> paramlist=constructor.getParameters(); List<String> target=resolveParams(paramlist); transformOneMethod(orig,target,ctConstructorCall); } } else { List<Class[]> params = parser.fetchMethods(type, type); for (Class[] p : params) transformOneConstructor(orig, ctConstructorCall, p); } }
Example 2
Source File: TransformStrategy.java From astor with GNU General Public License v2.0 | 6 votes |
@Override public <T> void visitCtConstructorCall(CtConstructorCall<T> ctConstructorCall) { super.visitCtConstructorCall(ctConstructorCall); List<CtExpression<?>> argumentlist = ctConstructorCall.getArguments(); for (int i = 0; i < argumentlist.size(); i++) { @SuppressWarnings("rawtypes") CtExpression p = argumentlist.get(i); if (candidates.containsKey(p)) { argumentlist.set(i, candidates.get(p)); // ctConstructorCall.setArguments(argumentlist); saveSketchAndSynthesize(); argumentlist.set(i, p); resoreDiskFile(); // ctConstructorCall.setArguments(argumentlist); } } }
Example 3
Source File: ConstructorAnalyzer.java From coming with MIT License | 4 votes |
private void analyzeVarConstructorArgumentPrimitive (List<CtConstructorCall> constructorsaffected, Cntx<Object> context) { try { for (CtConstructorCall conAffected : constructorsaffected) { boolean Con6ArgumentHasPrimitive = false; List<CtExpression> invocationArguments = conAffected.getArguments(); for(int index=0; index<invocationArguments.size(); index++ ) { CtExpression certainexpression=invocationArguments.get(index); if (certainexpression.getType()!=null && (certainexpression.getType().isPrimitive() || certainexpression.getType().getQualifiedName().toString().toLowerCase().endsWith("string") || certainexpression.getType().getQualifiedName().toString().toLowerCase().endsWith("long") || certainexpression.getType().getQualifiedName().toString().toLowerCase().endsWith("list") || certainexpression.getType().getQualifiedName().toString().toLowerCase().indexOf("string")!=-1 || certainexpression.getType().getQualifiedName().toString().toLowerCase().endsWith("boolean") || certainexpression.getType().getQualifiedName().toString().toLowerCase().endsWith("double") || certainexpression.getType().getQualifiedName().toString().toLowerCase().endsWith("byte")|| certainexpression.getType().getQualifiedName().toString().toLowerCase().endsWith("short")|| certainexpression.getType().getQualifiedName().toString().toLowerCase().endsWith("float") || certainexpression.getType().getQualifiedName().toString().toLowerCase().endsWith("chart") || certainexpression.getType().getQualifiedName().toString().toLowerCase().endsWith("character") || certainexpression.getType().getQualifiedName().toString().toLowerCase().endsWith("integer")|| certainexpression.getType().getQualifiedName().toString().toLowerCase().endsWith("string[]") || certainexpression.getType().getQualifiedName().toString().toLowerCase().endsWith("long[]") || certainexpression.getType().getQualifiedName().toString().toLowerCase().endsWith("boolean[]") || certainexpression.getType().getQualifiedName().toString().toLowerCase().endsWith("double[]") || certainexpression.getType().getQualifiedName().toString().toLowerCase().endsWith("byte[]")|| certainexpression.getType().getQualifiedName().toString().toLowerCase().endsWith("short[]")|| certainexpression.getType().getQualifiedName().toString().toLowerCase().endsWith("float[]") || certainexpression.getType().getQualifiedName().toString().toLowerCase().endsWith("chart[]") || certainexpression.getType().getQualifiedName().toString().toLowerCase().endsWith("character[]") || certainexpression.getType().getQualifiedName().toString().toLowerCase().endsWith("integer[]") || certainexpression.getType().getQualifiedName().toString().toLowerCase().startsWith("java.util.") || certainexpression.getType().getQualifiedName().toString().toLowerCase().startsWith("java.nio.") || certainexpression.getType().getQualifiedName().toString().toLowerCase().startsWith("java.io."))) { Con6ArgumentHasPrimitive = true; break; } } writeGroupedInfo(context, adjustIdentifyInJson(conAffected), CodeFeatures.CON6_Argument_Has_Primitive, Con6ArgumentHasPrimitive, "FEATURES_CONSTRUCTOR"); } } catch (Throwable e) { e.printStackTrace(); } }