private Property validateField(Property field) { if (field.getName().equals(modifiedSimpleName) || field.getEscapedName().equals(modifiedSimpleName)) { do { modifiedSimpleName = StringUtils.uncapitalize(getType().getSimpleName()) + (escapeSuffix++); } while (propertyNames.contains(modifiedSimpleName)); } return field; }
private String getPropertyName(UID propertyId) { String propertyName = normalize(propertyId.getLocalName()); if (nsToPropertyPrefix.containsKey(propertyId.getNamespace())) { propertyName = nsToPropertyPrefix.get(propertyId.getNamespace()) + StringUtils.capitalize(propertyName); } else if (stripHasOff && propertyName.startsWith("has") && propertyName.length() > 3) { propertyName = StringUtils.uncapitalize(propertyName.substring(3)); } return propertyName; }
private ScalaWriter appendType(Class<?> type) throws IOException { if (type.isPrimitive()) { append(StringUtils.capitalize(type.getName())); } else if (type.getPackage() == null || classes.contains(type.getName()) || packages.contains(type.getPackage().getName())) { append(type.getSimpleName()); } else { append(type.getName()); } return this; }
String escaped = StringUtils.escapeJava(value.toString()); append(QUOTE).append(escaped.replace("\\/", "/")).append(QUOTE); } else {
String fullName = type.getFullName(); if (PRIMITIVE_TYPES.contains(fullName)) { fullName = StringUtils.capitalize(fullName); rv = rv.substring(0, rv.length() - 2); if (PRIMITIVE_TYPES.contains(rv)) { rv = StringUtils.capitalize(rv); } else if (classes.contains(rv)) { rv = rv.substring(packageName.length() + 1);
append(QUOTE).append(StringUtils.escapeJava(value.toString())).append(QUOTE); } else { throw new IllegalArgumentException("Unsupported annotation value : " + value);
@Override public String apply(EntityType entity) { String uncapSimpleName = StringUtils.uncapitalize(entity.getInnerType().getSimpleName()); if (SourceVersion.isKeyword(uncapSimpleName)) { uncapSimpleName = uncapSimpleName + "$"; } return uncapSimpleName; } }
Date.class, java.sql.Date.class, java.sql.Time.class)) { Type classType = new ClassType(TypeCategory.get(cl.getName()), cl); type.addProperty(new Property(type, StringUtils.uncapitalize(cl.getSimpleName()), classType));
type.addProperty(new Property(type, StringUtils.uncapitalize(cl.getSimpleName()), classType));
@SuppressWarnings("unchecked") @Before public void setUp() { // type Type typeModel = new SimpleType(TypeCategory.ENTITY, "com.querydsl.DomainClass", "com.querydsl", "DomainClass", false, false); type = new EntityType(typeModel); // property type.addProperty(new Property(type, "entityField", type)); type.addProperty(new Property(type, "collection", new ClassType(TypeCategory.COLLECTION, Collection.class, typeModel))); type.addProperty(new Property(type, "listField", new ClassType(TypeCategory.LIST, List.class, typeModel))); type.addProperty(new Property(type, "setField", new ClassType(TypeCategory.SET, Set.class, typeModel))); type.addProperty(new Property(type, "arrayField", new ClassType(TypeCategory.ARRAY, String[].class, typeModel))); type.addProperty(new Property(type, "mapField", new ClassType(TypeCategory.MAP, List.class, typeModel, typeModel))); type.addProperty(new Property(type, "superTypeField", new TypeExtends(new ClassType(TypeCategory.MAP, List.class, typeModel, typeModel)))); type.addProperty(new Property(type, "extendsTypeField", new TypeSuper(new ClassType(TypeCategory.MAP, List.class, typeModel, typeModel)))); for (Class<?> cl : Arrays.asList(Boolean.class, Comparable.class, Integer.class, Date.class, java.sql.Date.class, java.sql.Time.class)) { Type classType = new ClassType(TypeCategory.get(cl.getName()), cl); type.addProperty(new Property(type, StringUtils.uncapitalize(cl.getSimpleName()), classType)); } // constructor Parameter firstName = new Parameter("firstName", new ClassType(TypeCategory.STRING, String.class)); Parameter lastName = new Parameter("lastName", new ClassType(TypeCategory.STRING, String.class)); type.addConstructor(new Constructor(Arrays.asList(firstName, lastName))); }
type.addProperty(new Property(type, StringUtils.uncapitalize(cl.getSimpleName()), classType));
type.addProperty(new Property(type, StringUtils.uncapitalize(cl.getSimpleName()), classType));
Date.class, java.sql.Date.class, java.sql.Time.class)) { Type classType = new ClassType(TypeCategory.get(cl.getName()), cl); type.addProperty(new Property(type, StringUtils.uncapitalize(cl.getSimpleName()), classType));
Date.class, java.sql.Date.class, java.sql.Time.class)) { Type classType = new ClassType(TypeCategory.get(cl.getName()), cl); type.addProperty(new Property(type, StringUtils.uncapitalize(cl.getSimpleName()), classType));
@SuppressWarnings("unchecked") @Before public void setUp() { // type Type typeModel = new SimpleType(TypeCategory.ENTITY, "com.querydsl.DomainClass", "com.querydsl", "DomainClass", false, false); type = new EntityType(typeModel); // property type.addProperty(new Property(type, "entityField", type)); type.addProperty(new Property(type, "collection", new ClassType(TypeCategory.COLLECTION, Collection.class, typeModel))); type.addProperty(new Property(type, "listField", new ClassType(TypeCategory.LIST, List.class, typeModel))); type.addProperty(new Property(type, "setField", new ClassType(TypeCategory.SET, Set.class, typeModel))); type.addProperty(new Property(type, "arrayField", new ClassType(TypeCategory.ARRAY, String[].class, typeModel))); type.addProperty(new Property(type, "mapField", new ClassType(TypeCategory.MAP, List.class, typeModel, typeModel))); type.addProperty(new Property(type, "superTypeField", new TypeExtends(new ClassType(TypeCategory.MAP, List.class, typeModel, typeModel)))); type.addProperty(new Property(type, "extendsTypeField", new TypeSuper(new ClassType(TypeCategory.MAP, List.class, typeModel, typeModel)))); for (Class<?> cl : Arrays.asList(Boolean.class, Comparable.class, Integer.class, Date.class, java.sql.Date.class, java.sql.Time.class)) { Type classType = new ClassType(TypeCategory.get(cl.getName()), cl); type.addProperty(new Property(type, StringUtils.uncapitalize(cl.getSimpleName()), classType)); } // constructor Parameter firstName = new Parameter("firstName", new ClassType(TypeCategory.STRING, String.class)); Parameter lastName = new Parameter("lastName", new ClassType(TypeCategory.STRING, String.class)); type.addConstructor(new Constructor(Arrays.asList(firstName, lastName))); }
@SuppressWarnings("unchecked") @Before public void setUp() { // type Type typeModel = new SimpleType(TypeCategory.ENTITY, "com.mysema.query.DomainClass", "com.mysema.query", "DomainClass", false, false); type = new EntityType(typeModel); // property type.addProperty(new Property(type, "entityField", type)); type.addProperty(new Property(type, "collection", new ClassType(TypeCategory.COLLECTION, Collection.class, typeModel))); type.addProperty(new Property(type, "listField", new ClassType(TypeCategory.LIST, List.class, typeModel))); type.addProperty(new Property(type, "setField", new ClassType(TypeCategory.SET, Set.class, typeModel))); type.addProperty(new Property(type, "arrayField", new ClassType(TypeCategory.ARRAY, String[].class, typeModel))); type.addProperty(new Property(type, "mapField", new ClassType(TypeCategory.MAP, List.class, typeModel, typeModel))); type.addProperty(new Property(type, "superTypeField", new TypeExtends(new ClassType(TypeCategory.MAP, List.class, typeModel, typeModel)))); type.addProperty(new Property(type, "extendsTypeField", new TypeSuper(new ClassType(TypeCategory.MAP, List.class, typeModel, typeModel)))); for (Class<?> cl : Arrays.asList(Boolean.class, Comparable.class, Integer.class, Date.class, java.sql.Date.class, java.sql.Time.class)) { Type classType = new ClassType(TypeCategory.get(cl.getName()), cl); type.addProperty(new Property(type, StringUtils.uncapitalize(cl.getSimpleName()), classType)); } // constructor Parameter firstName = new Parameter("firstName", new ClassType(TypeCategory.STRING, String.class)); Parameter lastName = new Parameter("lastName", new ClassType(TypeCategory.STRING, String.class)); type.addConstructor(new Constructor(Arrays.asList(firstName, lastName))); }