本文整理汇总了Java中org.eclipse.jdt.internal.compiler.lookup.TypeIds.T_short方法的典型用法代码示例。如果您正苦于以下问题:Java TypeIds.T_short方法的具体用法?Java TypeIds.T_short怎么用?Java TypeIds.T_short使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.internal.compiler.lookup.TypeIds
的用法示例。
在下文中一共展示了TypeIds.T_short方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getConstantValue
import org.eclipse.jdt.internal.compiler.lookup.TypeIds; //导入方法依赖的package包/类
public Object getConstantValue() {
Constant c = this.binding.constant();
if (c == null || c == Constant.NotAConstant) return null;
switch (c.typeID()) {
case TypeIds.T_boolean:
return Boolean.valueOf(c.booleanValue());
case TypeIds.T_byte:
return new Byte(c.byteValue());
case TypeIds.T_char:
return new Character(c.charValue());
case TypeIds.T_double:
return new Double(c.doubleValue());
case TypeIds.T_float:
return new Float(c.floatValue());
case TypeIds.T_int:
return new Integer(c.intValue());
case TypeIds.T_long:
return new Long(c.longValue());
case TypeIds.T_short:
return new Short(c.shortValue());
case TypeIds.T_JavaLangString:
return c.stringValue();
}
return null;
}
示例2: unannotated
import org.eclipse.jdt.internal.compiler.lookup.TypeIds; //导入方法依赖的package包/类
public TypeBinding unannotated() {
if (!this.hasTypeAnnotations())
return this;
switch (this.id) {
case TypeIds.T_boolean:
return TypeBinding.BOOLEAN;
case TypeIds.T_byte:
return TypeBinding.BYTE;
case TypeIds.T_char:
return TypeBinding.CHAR;
case TypeIds.T_double:
return TypeBinding.DOUBLE;
case TypeIds.T_float:
return TypeBinding.FLOAT;
case TypeIds.T_int:
return TypeBinding.INT;
case TypeIds.T_long:
return TypeBinding.LONG;
case TypeIds.T_short:
return TypeBinding.SHORT;
default:
throw new IllegalStateException();
}
}
示例3: calculateValue
import org.eclipse.jdt.internal.compiler.lookup.TypeIds; //导入方法依赖的package包/类
/**
* Returns the actual value of the given Literal or Literal-like node.
*/
public static Object calculateValue(Expression e) {
if (e instanceof Literal) {
((Literal)e).computeConstant();
switch (e.constant.typeID()) {
case TypeIds.T_int: return e.constant.intValue();
case TypeIds.T_byte: return e.constant.byteValue();
case TypeIds.T_short: return e.constant.shortValue();
case TypeIds.T_char: return e.constant.charValue();
case TypeIds.T_float: return e.constant.floatValue();
case TypeIds.T_double: return e.constant.doubleValue();
case TypeIds.T_boolean: return e.constant.booleanValue();
case TypeIds.T_long: return e.constant.longValue();
case TypeIds.T_JavaLangString: return e.constant.stringValue();
default: return null;
}
} else if (e instanceof ClassLiteralAccess) {
return Eclipse.toQualifiedName(((ClassLiteralAccess)e).type.getTypeName());
} else if (e instanceof SingleNameReference) {
return new String(((SingleNameReference)e).token);
} else if (e instanceof QualifiedNameReference) {
String qName = Eclipse.toQualifiedName(((QualifiedNameReference)e).tokens);
int idx = qName.lastIndexOf('.');
return idx == -1 ? qName : qName.substring(idx+1);
}
return null;
}
示例4: getAnnotationMemberValue
import org.eclipse.jdt.internal.compiler.lookup.TypeIds; //导入方法依赖的package包/类
public static Object getAnnotationMemberValue(
MemberValuePair memberValuePair, Constant constant) {
if (constant == null) {
memberValuePair.valueKind = IMemberValuePair.K_UNKNOWN;
return null;
}
switch (constant.typeID()) {
case TypeIds.T_int:
memberValuePair.valueKind = IMemberValuePair.K_INT;
return new Integer(constant.intValue());
case TypeIds.T_byte:
memberValuePair.valueKind = IMemberValuePair.K_BYTE;
return new Byte(constant.byteValue());
case TypeIds.T_short:
memberValuePair.valueKind = IMemberValuePair.K_SHORT;
return new Short(constant.shortValue());
case TypeIds.T_char:
memberValuePair.valueKind = IMemberValuePair.K_CHAR;
return new Character(constant.charValue());
case TypeIds.T_float:
memberValuePair.valueKind = IMemberValuePair.K_FLOAT;
return new Float(constant.floatValue());
case TypeIds.T_double:
memberValuePair.valueKind = IMemberValuePair.K_DOUBLE;
return new Double(constant.doubleValue());
case TypeIds.T_boolean:
memberValuePair.valueKind = IMemberValuePair.K_BOOLEAN;
return Boolean.valueOf(constant.booleanValue());
case TypeIds.T_long:
memberValuePair.valueKind = IMemberValuePair.K_LONG;
return new Long(constant.longValue());
case TypeIds.T_JavaLangString:
memberValuePair.valueKind = IMemberValuePair.K_STRING;
return constant.stringValue();
default:
memberValuePair.valueKind = IMemberValuePair.K_UNKNOWN;
return null;
}
}
示例5: accept
import org.eclipse.jdt.internal.compiler.lookup.TypeIds; //导入方法依赖的package包/类
@SuppressWarnings("unchecked") // Need to cast Object _value to a List<AnnotationValue>
@Override
public <R, P> R accept(AnnotationValueVisitor<R, P> v, P p) {
switch (_kind) {
case TypeIds.T_boolean:
return v.visitBoolean((Boolean)_value, p);
case TypeIds.T_byte:
return v.visitByte((Byte)_value, p);
case TypeIds.T_char:
return v.visitChar((Character)_value, p);
case TypeIds.T_double:
return v.visitDouble((Double)_value, p);
case TypeIds.T_float:
return v.visitFloat((Float)_value, p);
case TypeIds.T_int:
return v.visitInt((Integer)_value, p);
case TypeIds.T_JavaLangString:
return v.visitString((String)_value, p);
case TypeIds.T_long:
return v.visitLong((Long)_value, p);
case TypeIds.T_short:
return v.visitShort((Short)_value, p);
case T_EnumConstant:
return v.visitEnumConstant((VariableElement)_value, p);
case T_ClassObject:
return v.visitType((TypeMirror)_value, p);
case T_AnnotationMirror:
return v.visitAnnotation((AnnotationMirror)_value, p);
case T_ArrayType:
return v.visitArray((List<AnnotationValue>)_value, p);
default:
return null;
}
}
示例6: getAnnotationMemberValue
import org.eclipse.jdt.internal.compiler.lookup.TypeIds; //导入方法依赖的package包/类
public static Object getAnnotationMemberValue(MemberValuePair memberValuePair, Constant constant) {
if (constant == null) {
memberValuePair.valueKind = IMemberValuePair.K_UNKNOWN;
return null;
}
switch (constant.typeID()) {
case TypeIds.T_int :
memberValuePair.valueKind = IMemberValuePair.K_INT;
return new Integer(constant.intValue());
case TypeIds.T_byte :
memberValuePair.valueKind = IMemberValuePair.K_BYTE;
return new Byte(constant.byteValue());
case TypeIds.T_short :
memberValuePair.valueKind = IMemberValuePair.K_SHORT;
return new Short(constant.shortValue());
case TypeIds.T_char :
memberValuePair.valueKind = IMemberValuePair.K_CHAR;
return new Character(constant.charValue());
case TypeIds.T_float :
memberValuePair.valueKind = IMemberValuePair.K_FLOAT;
return new Float(constant.floatValue());
case TypeIds.T_double :
memberValuePair.valueKind = IMemberValuePair.K_DOUBLE;
return new Double(constant.doubleValue());
case TypeIds.T_boolean :
memberValuePair.valueKind = IMemberValuePair.K_BOOLEAN;
return Boolean.valueOf(constant.booleanValue());
case TypeIds.T_long :
memberValuePair.valueKind = IMemberValuePair.K_LONG;
return new Long(constant.longValue());
case TypeIds.T_JavaLangString :
memberValuePair.valueKind = IMemberValuePair.K_STRING;
return constant.stringValue();
default:
memberValuePair.valueKind = IMemberValuePair.K_UNKNOWN;
return null;
}
}
示例7: getConstantValue
import org.eclipse.jdt.internal.compiler.lookup.TypeIds; //导入方法依赖的package包/类
@Override
public Object getConstantValue() {
VariableBinding variableBinding = (VariableBinding) _binding;
Constant constant = variableBinding.constant();
if (constant == null || constant == Constant.NotAConstant) return null;
TypeBinding type = variableBinding.type;
switch (type.id) {
case TypeIds.T_boolean:
return constant.booleanValue();
case TypeIds.T_byte:
return constant.byteValue();
case TypeIds.T_char:
return constant.charValue();
case TypeIds.T_double:
return constant.doubleValue();
case TypeIds.T_float:
return constant.floatValue();
case TypeIds.T_int:
return constant.intValue();
case TypeIds.T_JavaLangString:
return constant.stringValue();
case TypeIds.T_long:
return constant.longValue();
case TypeIds.T_short:
return constant.shortValue();
}
return null;
}
示例8: convertConstant
import org.eclipse.jdt.internal.compiler.lookup.TypeIds; //导入方法依赖的package包/类
/**
* Converts a field constant from the compiler's representation
* to the Java Model constant representation (Number or String).
*/
protected static Object convertConstant(Constant constant) {
if (constant == null)
return null;
if (constant == Constant.NotAConstant) {
return null;
}
switch (constant.typeID()) {
case TypeIds.T_boolean :
return constant.booleanValue() ? Boolean.TRUE : Boolean.FALSE;
case TypeIds.T_byte :
return new Byte(constant.byteValue());
case TypeIds.T_char :
return new Character(constant.charValue());
case TypeIds.T_double :
return new Double(constant.doubleValue());
case TypeIds.T_float :
return new Float(constant.floatValue());
case TypeIds.T_int :
return new Integer(constant.intValue());
case TypeIds.T_long :
return new Long(constant.longValue());
case TypeIds.T_short :
return new Short(constant.shortValue());
case TypeIds.T_JavaLangString :
return constant.stringValue();
default :
return null;
}
}
示例9: hasSameValue
import org.eclipse.jdt.internal.compiler.lookup.TypeIds; //导入方法依赖的package包/类
/**
* Returns true if both constants have the same type and the same actual value
* @param otherConstant
*/
public boolean hasSameValue(Constant otherConstant) {
if (this == otherConstant)
return true;
int typeID;
if ((typeID = typeID()) != otherConstant.typeID())
return false;
switch (typeID) {
case TypeIds.T_boolean:
return booleanValue() == otherConstant.booleanValue();
case TypeIds.T_byte:
return byteValue() == otherConstant.byteValue();
case TypeIds.T_char:
return charValue() == otherConstant.charValue();
case TypeIds.T_double:
return doubleValue() == otherConstant.doubleValue();
case TypeIds.T_float:
return floatValue() == otherConstant.floatValue();
case TypeIds.T_int:
return intValue() == otherConstant.intValue();
case TypeIds.T_short:
return shortValue() == otherConstant.shortValue();
case TypeIds.T_long:
return longValue() == otherConstant.longValue();
case TypeIds.T_JavaLangString:
String value = stringValue();
return value == null
? otherConstant.stringValue() == null
: value.equals(otherConstant.stringValue());
}
return false;
}
示例10: setBinding
import org.eclipse.jdt.internal.compiler.lookup.TypeIds; //导入方法依赖的package包/类
public void setBinding(TypeBinding binding) {
this.constantPoolName = binding.constantPoolName();
final int typeBindingId = binding.id;
this.id = typeBindingId;
switch(typeBindingId) {
case TypeIds.T_boolean :
case TypeIds.T_byte :
case TypeIds.T_char :
case TypeIds.T_int :
case TypeIds.T_short :
this.tag = VerificationTypeInfo.ITEM_INTEGER;
break;
case TypeIds.T_float :
this.tag = VerificationTypeInfo.ITEM_FLOAT;
break;
case TypeIds.T_long :
this.tag = VerificationTypeInfo.ITEM_LONG;
break;
case TypeIds.T_double :
this.tag = VerificationTypeInfo.ITEM_DOUBLE;
break;
case TypeIds.T_null :
this.tag = VerificationTypeInfo.ITEM_NULL;
break;
default:
this.tag = VerificationTypeInfo.ITEM_OBJECT;
}
}
示例11: getWrappedConstantValue
import org.eclipse.jdt.internal.compiler.lookup.TypeIds; //导入方法依赖的package包/类
/**
* Return a wrapper that contains the constant of the field.
* @return java.lang.Object
*/
public Object getWrappedConstantValue() {
if (this.wrappedConstantValue == null) {
if (hasConstant()) {
Constant fieldConstant = getConstant();
switch (fieldConstant.typeID()) {
case TypeIds.T_int :
this.wrappedConstantValue = new Integer(fieldConstant.intValue());
break;
case TypeIds.T_byte :
this.wrappedConstantValue = new Byte(fieldConstant.byteValue());
break;
case TypeIds.T_short :
this.wrappedConstantValue = new Short(fieldConstant.shortValue());
break;
case TypeIds.T_char :
this.wrappedConstantValue = new Character(fieldConstant.charValue());
break;
case TypeIds.T_float :
this.wrappedConstantValue = new Float(fieldConstant.floatValue());
break;
case TypeIds.T_double :
this.wrappedConstantValue = new Double(fieldConstant.doubleValue());
break;
case TypeIds.T_boolean :
this.wrappedConstantValue = Util.toBoolean(fieldConstant.booleanValue());
break;
case TypeIds.T_long :
this.wrappedConstantValue = new Long(fieldConstant.longValue());
break;
case TypeIds.T_JavaLangString :
this.wrappedConstantValue = fieldConstant.stringValue();
}
}
}
return this.wrappedConstantValue;
}
示例12: VerificationTypeInfo
import org.eclipse.jdt.internal.compiler.lookup.TypeIds; //导入方法依赖的package包/类
public VerificationTypeInfo(TypeBinding binding) {
this.id = binding.id;
switch(binding.id) {
case TypeIds.T_boolean :
case TypeIds.T_byte :
case TypeIds.T_char :
case TypeIds.T_int :
case TypeIds.T_short :
this.tag = VerificationTypeInfo.ITEM_INTEGER;
break;
case TypeIds.T_float :
this.tag = VerificationTypeInfo.ITEM_FLOAT;
break;
case TypeIds.T_long :
this.tag = VerificationTypeInfo.ITEM_LONG;
break;
case TypeIds.T_double :
this.tag = VerificationTypeInfo.ITEM_DOUBLE;
break;
case TypeIds.T_null :
this.tag = VerificationTypeInfo.ITEM_NULL;
break;
default:
this.tag = VerificationTypeInfo.ITEM_OBJECT;
this.constantPoolName = binding.constantPoolName();
}
}
示例13: hasStructuralFieldChanges
import org.eclipse.jdt.internal.compiler.lookup.TypeIds; //导入方法依赖的package包/类
private boolean hasStructuralFieldChanges(FieldInfo currentFieldInfo, FieldInfo otherFieldInfo) {
// generic signature
if (!CharOperation.equals(currentFieldInfo.getGenericSignature(), otherFieldInfo.getGenericSignature()))
return true;
if (currentFieldInfo.getModifiers() != otherFieldInfo.getModifiers())
return true;
if ((currentFieldInfo.getTagBits() & TagBits.AnnotationDeprecated) != (otherFieldInfo.getTagBits() & TagBits.AnnotationDeprecated))
return true;
if (hasStructuralAnnotationChanges(currentFieldInfo.getAnnotations(), otherFieldInfo.getAnnotations()))
return true;
if (!CharOperation.equals(currentFieldInfo.getName(), otherFieldInfo.getName()))
return true;
if (!CharOperation.equals(currentFieldInfo.getTypeName(), otherFieldInfo.getTypeName()))
return true;
if (currentFieldInfo.hasConstant() != otherFieldInfo.hasConstant())
return true;
if (currentFieldInfo.hasConstant()) {
Constant currentConstant = currentFieldInfo.getConstant();
Constant otherConstant = otherFieldInfo.getConstant();
if (currentConstant.typeID() != otherConstant.typeID())
return true;
if (!currentConstant.getClass().equals(otherConstant.getClass()))
return true;
switch (currentConstant.typeID()) {
case TypeIds.T_int :
return currentConstant.intValue() != otherConstant.intValue();
case TypeIds.T_byte :
return currentConstant.byteValue() != otherConstant.byteValue();
case TypeIds.T_short :
return currentConstant.shortValue() != otherConstant.shortValue();
case TypeIds.T_char :
return currentConstant.charValue() != otherConstant.charValue();
case TypeIds.T_long :
return currentConstant.longValue() != otherConstant.longValue();
case TypeIds.T_float :
return currentConstant.floatValue() != otherConstant.floatValue();
case TypeIds.T_double :
return currentConstant.doubleValue() != otherConstant.doubleValue();
case TypeIds.T_boolean :
return currentConstant.booleanValue() != otherConstant.booleanValue();
case TypeIds.T_JavaLangString :
return !currentConstant.stringValue().equals(otherConstant.stringValue());
}
}
return false;
}
示例14: baseTypeReference
import org.eclipse.jdt.internal.compiler.lookup.TypeIds; //导入方法依赖的package包/类
public static final TypeReference baseTypeReference(int baseType, int dim) {
if (dim == 0) {
switch (baseType) {
case (TypeIds.T_void) :
return new SingleTypeReference(TypeBinding.VOID.simpleName, 0);
case (TypeIds.T_boolean) :
return new SingleTypeReference(TypeBinding.BOOLEAN.simpleName, 0);
case (TypeIds.T_char) :
return new SingleTypeReference(TypeBinding.CHAR.simpleName, 0);
case (TypeIds.T_float) :
return new SingleTypeReference(TypeBinding.FLOAT.simpleName, 0);
case (TypeIds.T_double) :
return new SingleTypeReference(TypeBinding.DOUBLE.simpleName, 0);
case (TypeIds.T_byte) :
return new SingleTypeReference(TypeBinding.BYTE.simpleName, 0);
case (TypeIds.T_short) :
return new SingleTypeReference(TypeBinding.SHORT.simpleName, 0);
case (TypeIds.T_int) :
return new SingleTypeReference(TypeBinding.INT.simpleName, 0);
default : //T_long
return new SingleTypeReference(TypeBinding.LONG.simpleName, 0);
}
}
switch (baseType) {
case (TypeIds.T_void) :
return new ArrayTypeReference(TypeBinding.VOID.simpleName, dim, 0);
case (TypeIds.T_boolean) :
return new ArrayTypeReference(TypeBinding.BOOLEAN.simpleName, dim, 0);
case (TypeIds.T_char) :
return new ArrayTypeReference(TypeBinding.CHAR.simpleName, dim, 0);
case (TypeIds.T_float) :
return new ArrayTypeReference(TypeBinding.FLOAT.simpleName, dim, 0);
case (TypeIds.T_double) :
return new ArrayTypeReference(TypeBinding.DOUBLE.simpleName, dim, 0);
case (TypeIds.T_byte) :
return new ArrayTypeReference(TypeBinding.BYTE.simpleName, dim, 0);
case (TypeIds.T_short) :
return new ArrayTypeReference(TypeBinding.SHORT.simpleName, dim, 0);
case (TypeIds.T_int) :
return new ArrayTypeReference(TypeBinding.INT.simpleName, dim, 0);
default : //T_long
return new ArrayTypeReference(TypeBinding.LONG.simpleName, dim, 0);
}
}
示例15: replaceWithElementType
import org.eclipse.jdt.internal.compiler.lookup.TypeIds; //导入方法依赖的package包/类
public void replaceWithElementType() {
if (this.constantPoolName[1] == 'L') {
this.constantPoolName = CharOperation.subarray(this.constantPoolName, 2, this.constantPoolName.length - 1);
} else {
this.constantPoolName = CharOperation.subarray(this.constantPoolName, 1, this.constantPoolName.length);
if (this.constantPoolName.length == 1) {
switch(this.constantPoolName[0]) {
case 'I' :
this.id = TypeIds.T_int;
break;
case 'B' :
this.id = TypeIds.T_byte;
break;
case 'S' :
this.id = TypeIds.T_short;
break;
case 'C' :
this.id = TypeIds.T_char;
break;
case 'J' :
this.id = TypeIds.T_long;
break;
case 'F' :
this.id = TypeIds.T_float;
break;
case 'D' :
this.id = TypeIds.T_double;
break;
case 'Z' :
this.id = TypeIds.T_boolean;
break;
case 'N' :
this.id = TypeIds.T_null;
break;
case 'V' :
this.id = TypeIds.T_void;
break;
}
}
}
}