for (JAbstractMethod m : methodTypes) { MethodStub stub = new MethodStub(); stub.isPublic = m.isPublic(); stub.enclosingType = getType(c); if (m.isMethod() != null) { stub.isMethod = true; stub.returnType = getType(m.isMethod().getReturnType()); stub.isStatic = m.isMethod().isStatic(); stub.isAbstract = m.isMethod().isAbstract(); stub.isNative = m.isMethod().isAbstract(); stub.isFinal = m.isMethod().isFinal(); } else { if (m.isPrivate() || m.isDefaultAccess()) { logger.log(Type.INFO, "Skipping non-visible constructor for class " + c.getName()); continue; if (m.getEnclosingType().isFinal() && !m.isPublic()) { logger.log(Type.INFO, "Skipping non-public constructor for final class" + c.getName()); continue; stub.name = m.getName(); methodStubs.add(stub); pbn(" new " + methodType + "(\"" + m.getName() + "\", "); pbn(stub.enclosingType + ", "); pbn(stub.returnType + ", "); if (m.getParameters() != null && m.getParameters().length > 0) { pbn("new Parameter[] {");
if ( method.isPrivate() || (!method.isPublic() && !mapperInfo.isSamePackage()) ) { .addStatement( "return $L($L)", method.getJsniSignature(), parametersName ) .build() ); } else { if ( null != method.isConstructor() ) { builder.addStatement( "return new $T($L)", typeName( beanInfo.getType() ), parametersName ); } else { builder.addStatement( "return $T.$L($L)", typeName( beanInfo.getType() ), method.getName(), parametersName );
private String[] makeArgsList(final Map<String, String> valueMap, JAbstractMethod method) { JParameter[] params = method.getParameters(); String[] args = new String[params.length]; int i = 0; for (JParameter param : params) { args[i++] = valueMap.get(param.getName()); } return args; } }
private void writeFunction(SourceWriter sw, JAbstractMethod method, boolean isConstructor) { // Static method are also valid test methods String object = (isConstructor || method.isMethod().isStatic()) ? "" : "test."; String call = object + method.getJsniSignature(); String methodName = isConstructor ? "new" : method.getName(); sw.println("'%s' : function(test) { return %s(); },", methodName, call); }
/** * Initialize the code builder to create a mapper. * * @param instance the class to call * * @return the code builder to create the mapper */ private CodeBlock.Builder initMethodCallCode( MapperInstance instance ) { CodeBlock.Builder builder = CodeBlock.builder(); if ( null == instance.getInstanceCreationMethod().isConstructor() ) { builder.add( "$T.$L", rawName( instance.getMapperType() ), instance.getInstanceCreationMethod().getName() ); } else { builder.add( "new $T", typeName( instance.getMapperType() ) ); } return builder; }
for (JParameter param : creator.getParameters()) { unfilledRequiredParams.put(param.getName(), param.getType());
private void writeFunction(SourceWriter sw, JAbstractMethod method, boolean isConstructor) { // Static method are also valid test methods String object = (isConstructor || method.isMethod().isStatic()) ? "" : "test."; String call = object + method.getJsniSignature(); String methodName = isConstructor ? "new" : method.getName(); sw.println("'%s' : function(test) { return %s(); },", methodName, call); }
for (JAbstractMethod m : methodTypes) { MethodStub stub = new MethodStub(); stub.isPublic = m.isPublic(); stub.enclosingType = getType(c); if (m.isMethod() != null) { stub.isMethod = true; stub.returnType = getType(m.isMethod().getReturnType()); stub.isStatic = m.isMethod().isStatic(); stub.isAbstract = m.isMethod().isAbstract(); stub.isNative = m.isMethod().isAbstract(); stub.isFinal = m.isMethod().isFinal(); } else { if (m.isPrivate() || m.isDefaultAccess()) { logger.log(Type.INFO, "Skipping non-visible constructor for class " + c.getName()); continue; if (m.getEnclosingType().isFinal() && !m.isPublic()) { logger.log(Type.INFO, "Skipping non-public constructor for final class" + c.getName()); continue; stub.name = m.getName(); methodStubs.add(stub); pbn(" new " + methodType + "(\"" + m.getName() + "\", "); pbn(stub.enclosingType + ", "); pbn(stub.returnType + ", "); if (m.getParameters() != null && m.getParameters().length > 0) { pbn("new Parameter[] {");
JParameter[] params = method.getParameters(); String[] args = new String[params.length]; args[0] = writer.parseElementToField(toAdd).getNextReference();
for (JAbstractMethod m : methodTypes) { MethodStub stub = new MethodStub(); stub.isPublic = m.isPublic(); stub.enclosingType = getType(c); if (m.isMethod() != null) { stub.isMethod = true; stub.returnType = getType(m.isMethod().getReturnType()); stub.isStatic = m.isMethod().isStatic(); stub.isAbstract = m.isMethod().isAbstract(); stub.isNative = m.isMethod().isAbstract(); stub.isFinal = m.isMethod().isFinal(); if (m.isPrivate() || m.isDefaultAccess()) { logger.log(Type.INFO, "Skipping non-visible constructor for class " + c.getName()); continue; if (m.getEnclosingType().isFinal() && !m.isPublic()) { logger.log(Type.INFO, "Skipping non-public constructor for final class" + c.getName()); continue; stub.name = m.getName(); methodStubs.add(stub); String methodAnnotations = getAnnotations(m.getDeclaredAnnotations()); pb("new " + methodType + "(\"" + m.getName() + "\", "); pb(stub.enclosingType + ", "); pb(stub.returnType + ", ");
private String[] makeArgsList(final Map<String, String> valueMap, JAbstractMethod method) { JParameter[] params = method.getParameters(); String[] args = new String[params.length]; int i = 0; for (JParameter param : params) { args[i++] = valueMap.get(param.getName()); } return args; } }
for (JAbstractMethod m : methodTypes) { MethodStub stub = new MethodStub(); stub.isPublic = m.isPublic(); stub.enclosingType = getType(c); if (m.isMethod() != null) { stub.isMethod = true; stub.returnType = getType(m.isMethod().getReturnType()); stub.isStatic = m.isMethod().isStatic(); stub.isAbstract = m.isMethod().isAbstract(); stub.isNative = m.isMethod().isAbstract(); stub.isFinal = m.isMethod().isFinal(); } else { if (m.isPrivate() || m.isDefaultAccess()) { logger.log(Type.INFO, "Skipping non-visible constructor for class " + c.getName()); continue; if (m.getEnclosingType().isFinal() && !m.isPublic()) { logger.log(Type.INFO, "Skipping non-public constructor for final class" + c.getName()); continue; stub.name = m.getName(); methodStubs.add(stub); pbn(" new " + methodType + "(\"" + m.getName() + "\", "); pbn(stub.enclosingType + ", "); pbn(stub.returnType + ", "); if (m.getParameters() != null && m.getParameters().length > 0) { pbn("new Parameter[] {");
private String[] makeArgsList(final Map<String, String> valueMap, JAbstractMethod method) { JParameter[] params = method.getParameters(); String[] args = new String[params.length]; int i = 0; for (JParameter param : params) { args[i++] = valueMap.get(param.getName()); } return args; } }
private static <T extends Annotation> boolean isAllParametersAnnotatedWith( JAbstractMethod method, Class<T> annotation ) { for ( JParameter parameter : method.getParameters() ) { if ( !parameter.isAnnotationPresent( annotation ) ) { return false; } } return true; }
private MapperType[] getParameters( JType mappedType, JAbstractMethod method, boolean isSerializers ) { if ( !isSerializers && typeOracle.isEnumSupertype( mappedType ) ) { if ( method.getParameters().length == 1 && Class.class.getName().equals( method.getParameters()[0].getType() .getQualifiedSourceName() ) ) { return new MapperType[0]; MapperType[] parameters = new MapperType[method.getParameters().length]; for ( int i = 0; i < method.getParameters().length; i++ ) { JParameter parameter = method.getParameters()[i]; if ( isSerializers ) { if ( typeOracle.isKeySerializer( parameter.getType() ) ) {
for (JParameter param : creator.getParameters()) { unfilledRequiredParams.put(param.getName(), param.getType());
for (JParameter param : creator.getParameters()) { unfilledRequiredParams.put(param.getName(), param.getType());
if ( creatorMethod.get().getParameters().length == 1 && !isAllParametersAnnotatedWith( creators .get( 0 ), JsonProperty.class ) ) { .getParameters()[0] ) ); } else { for ( int i = 0; i < creatorMethod.get().getParameters().length; i++ ) { creatorParameters.put( creators.get( 0 ).getParameters()[i].getAnnotation( JsonProperty.class ).value(), creators .get( creators.size() - 1 ).getParameters()[i] );
JParameter[] params = method.getParameters(); String[] args = new String[params.length]; args[0] = writer.parseElementToField(toAdd).getNextReference();
JParameter[] params = method.getParameters(); String[] args = new String[params.length]; args[0] = writer.parseElementToField(toAdd).getNextReference();