本文整理汇总了Java中net.bytebuddy.description.type.TypeDescription.isPrimitive方法的典型用法代码示例。如果您正苦于以下问题:Java TypeDescription.isPrimitive方法的具体用法?Java TypeDescription.isPrimitive怎么用?Java TypeDescription.isPrimitive使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.bytebuddy.description.type.TypeDescription
的用法示例。
在下文中一共展示了TypeDescription.isPrimitive方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: withNullValue
import net.bytebuddy.description.type.TypeDescription; //导入方法依赖的package包/类
/**
* Passes {@code null} values of the given types to the bootstrapped method.
*
* @param typeDescription The type that the {@code null} values should represent.
* @return This invoke dynamic implementation where the bootstrapped method is passed the specified arguments.
*/
public InvokeDynamic withNullValue(TypeDescription... typeDescription) {
List<InvocationProvider.ArgumentProvider> argumentProviders = new ArrayList<InvocationProvider.ArgumentProvider>(typeDescription.length);
for (TypeDescription aTypeDescription : typeDescription) {
if (aTypeDescription.isPrimitive()) {
throw new IllegalArgumentException("Cannot assign null to primitive type: " + aTypeDescription);
}
argumentProviders.add(new InvocationProvider.ArgumentProvider.ForNullValue(aTypeDescription));
}
return new InvokeDynamic(bootstrapMethod,
handleArguments,
invocationProvider.appendArguments(argumentProviders),
terminationHandler,
assigner,
typing);
}
示例2: result
import net.bytebuddy.description.type.TypeDescription; //导入方法依赖的package包/类
@Override
public final Result<StackManipulation> result() {
TypeDescription type = field.getType().asErasure();
if (type.isPrimitive()) {
return new SmtBox(type);
} else {
return new SmtDoNothing();
}
}
示例3: getReturnCode
import net.bytebuddy.description.type.TypeDescription; //导入方法依赖的package包/类
public static int getReturnCode(TypeDescription fieldType)
{
if (fieldType.isPrimitive())
{
if (BOOLEAN_P.equals(fieldType) || BYTE_P.equals(fieldType) || CHAR_P.equals(fieldType) ||
SHORT_P.equals(fieldType) || INT_P.equals(fieldType))
{
return IRETURN;
}
if (LONG_P.equals(fieldType))
{
return LRETURN;
}
if (FLOAT_P.equals(fieldType))
{
return FRETURN;
}
if (DOUBLE_P.equals(fieldType))
{
return DRETURN;
}
else
{
throw new IllegalStateException("Unknown store method");
}
}
else
{
return ARETURN;
}
}
示例4: getStoreCode
import net.bytebuddy.description.type.TypeDescription; //导入方法依赖的package包/类
public static int getStoreCode(TypeDescription fieldType)
{
if (fieldType.isPrimitive())
{
if (BOOLEAN_P.equals(fieldType) || BYTE_P.equals(fieldType) || CHAR_P.equals(fieldType) ||
SHORT_P.equals(fieldType) || INT_P.equals(fieldType))
{
return ISTORE;
}
if (LONG_P.equals(fieldType))
{
return LSTORE;
}
if (FLOAT_P.equals(fieldType))
{
return FSTORE;
}
if (DOUBLE_P.equals(fieldType))
{
return DSTORE;
}
else
{
throw new IllegalStateException("Unknown store method");
}
}
else
{
return ASTORE;
}
}
示例5: getLoadCode
import net.bytebuddy.description.type.TypeDescription; //导入方法依赖的package包/类
public static int getLoadCode(TypeDescription fieldType)
{
if (fieldType.isPrimitive())
{
if (BOOLEAN_P.equals(fieldType) || BYTE_P.equals(fieldType) || CHAR_P.equals(fieldType) ||
SHORT_P.equals(fieldType) || INT_P.equals(fieldType))
{
return ILOAD;
}
if (LONG_P.equals(fieldType))
{
return LLOAD;
}
if (FLOAT_P.equals(fieldType))
{
return FLOAD;
}
if (DOUBLE_P.equals(fieldType))
{
return DLOAD;
}
else
{
throw new IllegalStateException("Unknown load method");
}
}
else
{
return ALOAD;
}
}
示例6: of
import net.bytebuddy.description.type.TypeDescription; //导入方法依赖的package包/类
/**
* Creates a skip dispatcher for a given annotation type and advice method.
*
* @param typeDescription The type that was specified as an annotation value.
* @param adviceMethod The advice method.
* @return An appropriate skip dispatcher.
*/
protected static SkipDispatcher of(TypeDescription typeDescription, MethodDescription adviceMethod) {
if (typeDescription.represents(void.class)) {
return Disabled.INSTANCE;
} else if (typeDescription.represents(OnDefaultValue.class)) {
return ForValue.of(adviceMethod.getReturnType(), false);
} else if (typeDescription.represents(OnNonDefaultValue.class)) {
return ForValue.of(adviceMethod.getReturnType(), true);
} else if (typeDescription.isPrimitive() || adviceMethod.getReturnType().isPrimitive()) {
throw new IllegalStateException("Cannot skip method by instance type for primitive return value on " + adviceMethod);
} else {
return new ForType(typeDescription);
}
}
示例7: of
import net.bytebuddy.description.type.TypeDescription; //导入方法依赖的package包/类
/**
* Creates a type creation for the given type.
*
* @param typeDescription The type to be create.
* @return A stack manipulation that represents the creation of the given type.
*/
public static StackManipulation of(TypeDescription typeDescription) {
if (typeDescription.isArray() || typeDescription.isPrimitive() || typeDescription.isAbstract()) {
throw new IllegalArgumentException(typeDescription + " is not instantiable");
}
return new TypeCreation(typeDescription);
}
示例8: of
import net.bytebuddy.description.type.TypeDescription; //导入方法依赖的package包/类
/**
* Resolves a type locator based upon an annotation value.
*
* @param typeDescription The annotation's value.
* @return The appropriate type locator.
*/
protected static TypeLocator of(TypeDescription typeDescription) {
if (typeDescription.represents(void.class)) {
return ForParameterType.INSTANCE;
} else if (typeDescription.represents(TargetType.class)) {
return ForInstrumentedType.INSTANCE;
} else if (typeDescription.isPrimitive() || typeDescription.isArray()) {
throw new IllegalStateException("Cannot assign proxy to " + typeDescription);
} else {
return new ForType(typeDescription);
}
}
示例9: matches
import net.bytebuddy.description.type.TypeDescription; //导入方法依赖的package包/类
@Override
public final boolean matches(TypeDescription target) {
return target.isPrimitive() || target.isPrimitiveWrapper() || anyOf(JAVA_ATOMS).matches(target);
}
示例10: getWrapperClass
import net.bytebuddy.description.type.TypeDescription; //导入方法依赖的package包/类
/**
* If given type is primitive type {@link TypeDescription#isPrimitive()} then it will return
* wrapper type for it. Like: boolean.class {@literal ->} Boolean.class
* If given type isn't primitive, then it will return given type.
*
* @param type
* type to get wrapper of it.
*
* @return non-primitive type.
*/
public static TypeDescription getWrapperClass(TypeDescription type)
{
if (! type.isPrimitive())
{
return type;
}
if (type.equals(BOOLEAN_P))
{
return BOOLEAN;
}
if (type.equals(BYTE_P))
{
return BYTE;
}
if (type.equals(SHORT_P))
{
return SHORT;
}
if (type.equals(CHAR_P))
{
return CHARACTER;
}
if (type.equals(INT_P))
{
return INTEGER;
}
if (type.equals(LONG_P))
{
return LONG;
}
if (type.equals(FLOAT_P))
{
return FLOAT;
}
if (type.equals(DOUBLE_P))
{
return DOUBLE;
}
if (type.equals(VOID_P))
{
return VOID;
}
throw new Error("Unknown primitive type?"); // not possible?
}
示例11: to
import net.bytebuddy.description.type.TypeDescription; //导入方法依赖的package包/类
/**
* Delegates any intercepted method to invoke a {@code static} method that is declared by the supplied type. To be considered
* a valid delegation target, the target method must be visible and accessible to the instrumented type. This is the case if
* the target type is either public or in the same package as the instrumented type and if the target method is either public
* or non-private and in the same package as the instrumented type. Private methods can only be used as a delegation target if
* the delegation is targeting the instrumented type.
*
* @param typeDescription The target type for the delegation.
* @return A method delegation that redirects method calls to a static method of the supplied type.
*/
public MethodDelegation to(TypeDescription typeDescription) {
if (typeDescription.isArray()) {
throw new IllegalArgumentException("Cannot delegate to array " + typeDescription);
} else if (typeDescription.isPrimitive()) {
throw new IllegalArgumentException("Cannot delegate to primitive " + typeDescription);
}
return new MethodDelegation(ImplementationDelegate.ForStaticMethod.of(typeDescription.getDeclaredMethods().filter(isStatic().and(matcher)),
TargetMethodAnnotationDrivenBinder.of(parameterBinders)), parameterBinders, ambiguityResolver, bindingResolver);
}