public int compare (JType o1, JType o2) { return o1.getQualifiedSourceName().compareTo(o2.getQualifiedSourceName()); } });
public int compare (JType o1, JType o2) { return o1.getQualifiedSourceName().compareTo(o2.getQualifiedSourceName()); } });
private String getType (JType type) { if (!isVisible(type)) return null; return type.getErasedType().getQualifiedSourceName() + ".class"; }
private String getType (JType type) { if (!isVisible(type)) return null; return type.getErasedType().getQualifiedSourceName() + ".class"; }
private void newArrayC () { p("public Object newArray (Type t, int size) {"); p(" if (t != null) {"); SwitchedCodeBlock pc = new SwitchedCodeBlock("t.id"); for (JType type : types) { if (type.getQualifiedSourceName().equals("void")) continue; if (type.getQualifiedSourceName().endsWith("Void")) continue; String arrayType = type.getErasedType().getQualifiedSourceName() + "[size]"; if (arrayType.contains("[]")) { arrayType = type.getErasedType().getQualifiedSourceName(); arrayType = arrayType.replaceFirst("\\[\\]", "[size]") + "[]"; } pc.add(typeNames2typeIds.get(type.getQualifiedSourceName()), "return new " + arrayType + ";"); } pc.print(); p(" }"); p(" throw new RuntimeException(\"Couldn't create array\");"); p("}"); }
private void newArrayC () { p("public Object newArray (Type t, int size) {"); p(" if (t != null) {"); SwitchedCodeBlock pc = new SwitchedCodeBlock("t.id"); for (JType type : types) { if (type.getQualifiedSourceName().equals("void")) continue; if (type.getQualifiedSourceName().endsWith("Void")) continue; String arrayType = type.getErasedType().getQualifiedSourceName() + "[size]"; if (arrayType.contains("[]")) { arrayType = type.getErasedType().getQualifiedSourceName(); arrayType = arrayType.replaceFirst("\\[\\]", "[size]") + "[]"; } pc.add(typeNames2typeIds.get(type.getQualifiedSourceName()), "return new " + arrayType + ";"); } pc.print(); p(" }"); p(" throw new RuntimeException(\"Couldn't create array\");"); p("}"); }
if (type.getQualifiedSourceName().contains("-")) { nesting--; return; String name = type.getQualifiedSourceName(); try { ConfigurationProperty prop; out(type.getErasedType().getQualifiedSourceName(), nesting);
if (type.getQualifiedSourceName().contains("-")) { nesting--; return; String name = type.getQualifiedSourceName(); try { ConfigurationProperty prop; out(type.getErasedType().getQualifiedSourceName(), nesting);
private String createTypeGenerator (JType t) { sb.setLength(0); int id = nextTypeId++; typeNames2typeIds.put(t.getErasedType().getQualifiedSourceName(), id); JClassType c = t.isClass(); String name = t.getErasedType().getQualifiedSourceName(); String superClass = null; if (c != null && (isVisible(c.getSuperclass()))) boolean used = false; for (JType i : c.getFlattenedSupertypeHierarchy()) { if (!isVisible(i) || i.equals(t) || "java.lang.Object".equals(i.getErasedType().getQualifiedSourceName())) continue; if (used) assignables += ", "; assignables += i.getErasedType().getQualifiedSourceName() + ".class"; used = true; if (!isVisible(i) || i.equals(t)) continue; if (used) interfaces += ", "; interfaces += i.getErasedType().getQualifiedSourceName() + ".class"; used = true;
private String createTypeGenerator (JType t) { sb.setLength(0); int id = nextTypeId++; typeNames2typeIds.put(t.getErasedType().getQualifiedSourceName(), id); JClassType c = t.isClass(); String name = t.getErasedType().getQualifiedSourceName(); String superClass = null; if (c != null && (isVisible(c.getSuperclass()))) boolean used = false; for (JType i : c.getFlattenedSupertypeHierarchy()) { if (!isVisible(i) || i.equals(t) || "java.lang.Object".equals(i.getErasedType().getQualifiedSourceName())) continue; if (used) assignables += ", "; assignables += i.getErasedType().getQualifiedSourceName() + ".class"; used = true; if (!isVisible(i) || i.equals(t)) continue; if (used) interfaces += ", "; interfaces += i.getErasedType().getQualifiedSourceName() + ".class"; used = true;
@Override public String createAssignment(TreeLogger logger, ResourceContext context, JMethod method) throws UnableToCompleteException { JClassType gwtType = context.getGeneratorContext().getTypeOracle().findType( GWT.class.getName()); assert gwtType != null; return gwtType.getQualifiedSourceName() + ".create(" + method.getReturnType().getQualifiedSourceName() + ".class)"; } }
if (referenceType == null) { throw new NotFoundException("Cannot resolve member " + pathElement + " on type " + currentType.getQualifiedSourceName()); + pathElement + " in type " + currentType.getQualifiedSourceName()); + expectedReturnType.getQualifiedSourceName() + " found " + currentMethod.getReturnType().getQualifiedSourceName());
&& toImplement.getParameters().length == 0) { writeDefAssignment(logger, sw, toImplement, sheet); } else if (toImplement.getReturnType().getQualifiedSourceName() .equals("java.lang.String") && toImplement.getParameters().length == 0) {
String initializer; if (writer.getDesignTime().isDesignTime()) { String typeName = factoryMethod.getReturnType().getQualifiedSourceName(); initializer = writer.getDesignTime().getProvidedFactory(typeName, factoryMethod.getName(),
protected String getResourceImplAsString(TreeLogger logger, ResourceContext context, JMethod method, Map<JMethod, String> actualReplacements, JClassType cssResourceSubtype, CssStylesheet stylesheet) throws UnableToCompleteException { SourceWriter sw = new StringSourceWriter(); // Write the expression to create the subtype. sw.println("new " + method.getReturnType().getQualifiedSourceName() + "() {"); sw.indent(); // Methods defined by CssResource interface writeEnsureInjected(sw); writeGetName(method, sw); // Create the Java expression that generates the CSS writeGetText(logger, context, method, sw); // getOverridableMethods is used to handle CssResources extending // non-CssResource types. See the discussion in computeReplacementsForType. writeUserMethods(logger, sw, stylesheet, cssResourceSubtype.getOverridableMethods(), actualReplacements); sw.outdent(); sw.println("}"); return sw.toString(); }
@Override public String createAssignment(TreeLogger logger, ResourceContext context, JMethod method) throws UnableToCompleteException { CssParsingResult cssParsingResult = cssParsingResultMap.get(method); CssTree cssTree = cssParsingResult.tree; RenamingResult renamingResult = doClassRenaming(cssTree, method, logger, context); // TODO : Should we foresee configuration properties for simplifyCss and eliminateDeadCode // booleans ? ConstantDefinitions constantDefinitions = optimizeTree(cssParsingResult, context, true, true, logger); checkErrors(); Set<String> externalClasses = revertRenamingOfExternalClasses(cssTree, renamingResult); checkErrors(); // Validate that classes not assigned to one of the interface methods are external validateExternalClasses(externalClasses, renamingResult.externalClassCandidate, method, logger); SourceWriter sw = new StringSourceWriter(); sw.println("new " + method.getReturnType().getQualifiedSourceName() + "() {"); sw.indent(); Map<JMethod, String> actualReplacements = writeMethods(logger, context, method, sw, constantDefinitions, cssParsingResult.originalConstantNameMapping, renamingResult.mapping); sw.outdent(); sw.println("}"); CssResourceGenerator.outputCssMapArtifact(logger, context, method, actualReplacements); return sw.toString(); }
static String noGetterMessage(String propertyName, JType proxyType) { return String.format( "Could not find a getter for path %s in proxy type %s", propertyName, proxyType.getQualifiedSourceName()); }
/** * Check if the specified parameter type represents a {@link SafeUri}. * * @param parameterType the Java parameter type * @return true if the type represents a {@link SafeUri} */ private boolean isSafeUri(JType parameterType) { return parameterType.getQualifiedSourceName().equals(SAFE_URI_FQCN); } }
private static String simplify(final com.google.gwt.core.ext.typeinfo.JParameter[] params) { final StringBuilder b = new StringBuilder(); for (final com.google.gwt.core.ext.typeinfo.JParameter param : params) { b.append(param.getType().getErasedType().getQualifiedSourceName().charAt(0)); } return b.toString(); }
protected <T extends JType> void appendClassArray(final MethodBuffer out, final T[] types, final ReflectionGeneratorContext ctx) { int i = types.length; final String[] names = new String[i]; for (; i-- > 0;) { names[i] = types[i].getErasedType().getQualifiedSourceName(); } final ConstPoolGenerator constPool = ctx.getConstPool(); constPool.arrayOfClasses(ctx.getLogger(), out, names); }