public static final JavaHelpers getType(Field field) { if(field == null) { return null; } return (JavaHelpers)field.getEType(); }
protected static String getTypeName(Field aField) { if (aField == null) return null; JavaHelpers type = (JavaHelpers)aField.getEType(); return getTypeName(type); }
protected EClassifier getTypeFromBeanField() { EClassifier type = null; Field field = getField(); if (field != null) type = field.getEType(); if (type == null) type = getKeyFieldTypeFromKeyClass(); return type; } public EClassifier get20Type() {
for (int i = 0; i < fields.size(); i++) { field = (Field) fields.get(i); out.append(" " + ((JavaHelpers) field.getEType()).getJavaName() + " " + field.getName() + "\n");
/** * @return */ private EClassifier getKeyFieldTypeFromKeyClass() { if (isKey()) { JavaClass key = getCMPEntity().getPrimaryKey(); if (key != null && key.getQualifiedName() != null && !key.getQualifiedName().startsWith("java.lang")) { //$NON-NLS-1$ Field field = key.getFieldExtended(getName()); if (field != null) return field.getEType(); } else return key; } return null; } public boolean isCMRField() {
/** * Used for the very narrow case of final static Strings */ protected void setInitializerIfPossible() { if (!(getTargetField().isStatic() && getTargetField().isFinal() && "java.lang.String".equals(((JavaHelpers) getTargetField().getEType()).getQualifiedName()))) //$NON-NLS-1$ return; String value = null; try { value = (String) getSourceField().get(null); } catch (IllegalAccessException ex) { return; } if (value == null) return; else value = "\"".concat(value).concat("\""); //$NON-NLS-2$//$NON-NLS-1$ Block aBlock = createBlock(getTargetField().getName(), value); getTargetField().setInitializer(aBlock); } /**
field = findExistingField(); if (field != null && getEType() != null && field.getEType() == null) field.setEType(getEType()); break;
protected void validatePrimitivePrimaryKey(IEJBValidationContext vc, EnterpriseBean bean, JavaClass clazz) throws InvalidInputException { ContainerManagedEntity cmp = (ContainerManagedEntity) bean; // bean is checked for null in AValidateEJB.validate() method, so don't need to check for it here. if (ValidationRuleUtility.isPrimitivePrimaryKey(cmp)) { // primitive primary key // primary key that maps to a single field in the entity bean class // The field's type must be the primary key type. CMPAttribute keyAttribute = cmp.getPrimKeyField(); Field keyField = (keyAttribute == null) ? null : keyAttribute.getField(); JavaClass primaryKey = cmp.getPrimaryKey(); if ((keyField == null) || !ValidationRuleUtility.isAssignableFrom((JavaHelpers)keyField.getEType(), primaryKey)) { String[] msgParm = { keyAttribute.getName(), primaryKey.getName()}; IMessage message = MessageUtility.getUtility().getMessage(vc, IMessagePrefixEjb11Constants.CHKJ2207, IEJBValidationContext.ERROR, bean, clazz, keyField, msgParm, this); vc.addMessage(message); } } }