001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * // Copyright (c) 1998, 2007, Oracle. All rights reserved.
005: *
006: *
007: * The contents of this file are subject to the terms of either the GNU
008: * General Public License Version 2 only ("GPL") or the Common Development
009: * and Distribution License("CDDL") (collectively, the "License"). You
010: * may not use this file except in compliance with the License. You can obtain
011: * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
012: * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
013: * language governing permissions and limitations under the License.
014: *
015: * When distributing the software, include this License Header Notice in each
016: * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
017: * Sun designates this particular file as subject to the "Classpath" exception
018: * as provided by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the License
020: * Header, with the fields enclosed by brackets [] replaced by your own
021: * identifying information: "Portions Copyrighted [year]
022: * [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * If you wish your version of this file to be governed by only the CDDL or
027: * only the GPL Version 2, indicate your decision by adding "[Contributor]
028: * elects to include this software in this distribution under the [CDDL or GPL
029: * Version 2] license." If you don't indicate a single choice of license, a
030: * recipient has the option to distribute your version of this file under
031: * either the CDDL, the GPL Version 2 or to extend the choice of license to
032: * its licensees as provided above. However, if you add GPL Version 2 code
033: * and therefore, elected the GPL Version 2 license, then the option applies
034: * only if the new code is made subject to such option by the copyright
035: * holder.
036: */
037: package oracle.toplink.essentials.internal.parsing;
038:
039: /**
040: * INTERNAL
041: * <p><b>Purpose</b>: Specify type helper methods.
042: */
043: public interface TypeHelper {
044:
045: /** Returns the name of the specified type. */
046: public String getTypeName(Object type);
047:
048: /** Returns the class object of the specified type. */
049: public Class getJavaClass(Object type);
050:
051: /** Returns a type representation for the specified type name or null if
052: * there is no such type. */
053: public Object resolveTypeName(String typeName);
054:
055: /** Returns the type of the attribute with the specified name in the
056: * specified owner class. */
057: public Object resolveAttribute(Object ownerClass, String attribute);
058:
059: /** Returns the type of the class corresponding to the spcified abstract
060: * schema type. */
061: public Object resolveSchema(String schemaName);
062:
063: /** Returns the enum constant if the specified type denotes an enum type
064: * and the specified constant denotes a constant of the enum type. */
065: public Object resolveEnumConstant(Object enumType, String constant);
066:
067: /** Returns the type representation of class Object.*/
068: public Object getObjectType();
069:
070: /** Returns the boolean type representation.*/
071: public Object getBooleanType();
072:
073: /** Returns the char type representation.*/
074: public Object getCharType();
075:
076: /** Returns the int type representation.*/
077: public Object getIntType();
078:
079: /** Returns the long type representation.*/
080: public Object getLongType();
081:
082: /** Returns the type representation of class Long.*/
083: public Object getLongClassType();
084:
085: /** Returns the float type representation.*/
086: public Object getFloatType();
087:
088: /** Returns the double type representation.*/
089: public Object getDoubleType();
090:
091: /** Returns the type representation of class Double.*/
092: public Object getDoubleClassType();
093:
094: /** Returns the type representation oc class String.*/
095: public Object getStringType();
096:
097: /** Returns the type representation of class BigInteger.*/
098: public Object getBigIntegerType();
099:
100: /** Returns the type representation of class BigDecimal.*/
101: public Object getBigDecimalType();
102:
103: /** Returns true if the specified type denotes an enum type. */
104: public boolean isEnumType(Object type);
105:
106: /** Returns true if the specified type represents an
107: * integral type (or wrapper), a floating point type (or wrapper),
108: * BigInteger or BigDecimal. */
109: public boolean isNumericType(Object type);
110:
111: /** Returns true if the specified type represents an
112: * integral type or a wrapper class of an integral type. */
113: public boolean isIntegralType(Object type);
114:
115: /** Returns true if the specified type represents an floating point type
116: * or a wrapper class of an floating point type. */
117: public boolean isFloatingPointType(Object type);
118:
119: /** Returns true if the specified type represents java.lang.String. */
120: public boolean isStringType(Object type);
121:
122: /** Returns true if the specified type represents java.math.BigInteger. */
123: public boolean isBigIntegerType(Object type);
124:
125: /** Returns true if the specified type represents java.math.BigDecimal. */
126: public boolean isBigDecimalType(Object type);
127:
128: /** Returns true if the specified type denotes an orable type. */
129: public boolean isOrderableType(Object type);
130:
131: /** Returns true if the specified type denotes an entity class. */
132: public boolean isEntityClass(Object type);
133:
134: /** Returns true if the specified type denotes an embedded class. */
135: public boolean isEmbeddable(Object type);
136:
137: /** Returns true if the specified type denotes an embedded attribute. */
138: public boolean isEmbeddedAttribute(Object ownerClass,
139: String attribute);
140:
141: /** Returns true if the specified type denotes a simple state attribute. */
142: public boolean isSimpleStateAttribute(Object ownerClass,
143: String attribute);
144:
145: /** Returns true if the specified attribute denotes a single valued
146: * or collection valued relationship attribute.
147: */
148: public boolean isRelationship(Object ownerClass, String attribute);
149:
150: /** Returns true if the specified attribute denotes a single valued
151: * relationship attribute.
152: */
153: public boolean isSingleValuedRelationship(Object ownerClass,
154: String attribute);
155:
156: /** Returns true if the specified attribute denotes a collection valued
157: * relationship attribute.
158: */
159: public boolean isCollectionValuedRelationship(Object ownerClass,
160: String attribute);
161:
162: /** Returns true if left is assignable from right. */
163: public boolean isAssignableFrom(Object left, Object right);
164:
165: /** Binary numeric promotion as specified in the JLS, extended by
166: * wrapper classes, BigDecimal and BigInteger. */
167: public Object extendedBinaryNumericPromotion(Object left,
168: Object right);
169: }
|