List of usage examples for com.google.gwt.dev.asm Type getSort
public int getSort()
From source file:com.google.web.bindery.requestfactory.server.RequestFactoryInterfaceValidator.java
License:Apache License
/** * This looks like it should be a utility method somewhere else, but I can't * find it./*from ww w .j av a 2 s .c o m*/ */ private Type getBoxedType(Type primitive) { switch (primitive.getSort()) { case Type.BOOLEAN: return Type.getType(Boolean.class); case Type.BYTE: return Type.getType(Byte.class); case Type.CHAR: return Type.getType(Character.class); case Type.DOUBLE: return Type.getType(Double.class); case Type.FLOAT: return Type.getType(Float.class); case Type.INT: return Type.getType(Integer.class); case Type.LONG: return Type.getType(Long.class); case Type.SHORT: return Type.getType(Short.class); case Type.VOID: return Type.getType(Void.class); } throw new RuntimeException(primitive.getDescriptor() + " is not a primitive type"); }
From source file:com.google.web.bindery.requestfactory.server.RequestFactoryInterfaceValidator.java
License:Apache License
private List<Type> getSupertypes(ErrorContext logger, Type type) { if (type.getSort() != Type.OBJECT) { return Collections.emptyList(); }/*w ww . j ava 2s. com*/ List<Type> toReturn = supertypes.get(type); if (toReturn != null) { return toReturn; } logger = logger.setType(type); toReturn = new SupertypeCollector(logger).exec(type); supertypes.put(type, Collections.unmodifiableList(toReturn)); return toReturn; }
From source file:com.google.web.bindery.requestfactory.server.RequestFactoryInterfaceValidator.java
License:Apache License
private boolean isValueType(ErrorContext logger, Type type) { if (type.getSort() != Type.OBJECT) { return true; }//ww w . jav a 2s. co m if (valueTypes.contains(type)) { return true; } logger = logger.setType(type); if (isAssignable(logger, enumType, type)) { return true; } return false; }
From source file:com.google.web.bindery.requestfactory.server.RequestFactoryInterfaceValidator.java
License:Apache License
private Type maybeBoxType(Type maybePrimitive) { if (maybePrimitive.getSort() == Type.OBJECT) { return maybePrimitive; }/*from w w w. j a v a 2 s. com*/ return getBoxedType(maybePrimitive); }
From source file:com.google.web.bindery.requestfactory.server.RequestFactoryJarExtractor.java
License:Apache License
/** * Process a type, possibly returning a rebased type. * /*from w w w. j av a 2s.co m*/ * @param sourceType TODO */ private Type processType(String sourceType, Type type) { Type toReturn; synchronized (seen) { toReturn = seen.get(type); if (toReturn != null) { return toReturn; } toReturn = Type.getType(type.getDescriptor()); seen.put(type, toReturn); } int sort = type.getSort(); if (sort != Type.OBJECT && sort != Type.ARRAY) { return toReturn; } if (sort == Type.ARRAY) { processType(sourceType, type.getElementType()); return toReturn; } assert type.getInternalName().charAt(0) != 'L'; if (type.getInternalName().startsWith("java/") || type.getInternalName().startsWith("javax/")) { return toReturn; } if (VERBOSE) { System.out.println(sourceType + " -> " + type.getClassName()); } Future<State> future = ex.submit(new ProcessOneType(type)); inProcess.add(future); return toReturn; }
From source file:com.google.web.bindery.requestfactory.server.ResolverServiceLayer.java
License:Apache License
private Class<?> getClass(Type type) { switch (type.getSort()) { case Type.BOOLEAN: return boolean.class; case Type.BYTE: return byte.class; case Type.CHAR: return char.class; case Type.DOUBLE: return double.class; case Type.FLOAT: return float.class; case Type.INT: return int.class; case Type.LONG: return long.class; case Type.OBJECT: return forName(type.getClassName()); case Type.SHORT: return short.class; case Type.VOID: return void.class; case Type.ARRAY: return die(null, "Unsupported Type used in operation descriptor %s", type.getDescriptor()); default:/* w w w. j av a 2s .com*/ // Error in this switch statement return die(null, "Unhandled Type: %s", type.getDescriptor()); } }