本文整理了Java中org.jboss.errai.codegen.meta.MetaClass.getOuterComponentType()
方法的一些代码示例,展示了MetaClass.getOuterComponentType()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MetaClass.getOuterComponentType()
方法的具体详情如下:
包路径:org.jboss.errai.codegen.meta.MetaClass
类名称:MetaClass
方法名:getOuterComponentType
暂无
代码示例来源:origin: errai/errai
@Override
public Object[] getEmptyArray() {
return (Object[]) Array.newInstance(arrayType.getOuterComponentType().asClass(), 0);
}
}
代码示例来源:origin: org.jboss.errai/errai-marshalling
@Override
public Object[] getEmptyArray() {
return (Object[]) Array.newInstance(arrayType.getOuterComponentType().asClass(), 0);
}
}
代码示例来源:origin: errai/errai
public DefaultArrayMarshaller(final MetaClass arrayType, final Marshaller<Object> outerMarshaller) {
this.arrayType = Assert.notNull(arrayType);
this.outerMarshaller = Assert.notNull("no outer marshaller specified for: " +
arrayType.getOuterComponentType().getFullyQualifiedName(),
outerMarshaller);
Class<?> type = arrayType.asClass();
int dim = 0;
while (type.isArray()) {
dim++;
type = type.getComponentType();
}
this.dimensions = dim;
}
代码示例来源:origin: org.jboss.errai/errai-marshalling
public DefaultArrayMarshaller(final MetaClass arrayType, final Marshaller<Object> outerMarshaller) {
this.arrayType = Assert.notNull(arrayType);
this.outerMarshaller = Assert.notNull("no outer marshaller specified for: " +
arrayType.getOuterComponentType().getFullyQualifiedName(),
outerMarshaller);
Class<?> type = arrayType.asClass();
int dim = 0;
while (type.isArray()) {
dim++;
type = type.getComponentType();
}
this.dimensions = dim;
}
代码示例来源:origin: org.jboss.errai/errai-marshalling
public Object demarshall(final EJValue a0, final MarshallingSession a1) {
if (a0.isNull()) {
return null;
}
else {
final EJArray arr = a0.isArray();
final int[] dims = new int[dimensions];
dims[0] = arr.size();
final Object arrayInstance = Array.newInstance(arrayType.getOuterComponentType().asClass(), dims);
_demarshall(dimensions - 1, arrayInstance, arr, a1);
return arrayInstance;
}
}
代码示例来源:origin: errai/errai
public Object demarshall(final EJValue a0, final MarshallingSession a1) {
if (a0.isNull()) {
return null;
}
else {
final EJArray arr = a0.isArray();
final int[] dims = new int[dimensions];
dims[0] = arr.size();
final Object arrayInstance = Array.newInstance(arrayType.getOuterComponentType().asClass(), dims);
_demarshall(dimensions - 1, arrayInstance, arr, a1);
return arrayInstance;
}
}
代码示例来源:origin: org.jboss.errai/errai-marshalling
private boolean needsLazyInit(MetaClass type) {
MetaClass compType = type.getOuterComponentType().getErased();
return (!compType.asUnboxed().isPrimitive() && !compType.equals(MetaClassFactory.get(String.class)) && !context
.getDefinitionsFactory().hasBuiltInDefinition(compType));
}
代码示例来源:origin: errai/errai
private boolean needsLazyInit(MetaClass type) {
MetaClass compType = type.getOuterComponentType().getErased();
return (!compType.asUnboxed().isPrimitive() && !compType.equals(MetaClassFactory.get(String.class)) && !context
.getDefinitionsFactory().hasBuiltInDefinition(compType));
}
代码示例来源:origin: errai/errai
@Override
public MetaClass getType() {
final MetaClass ret;
final int dims = GenUtil.getArrayDimensions(ref.getType());
if (ref.getType().isArray() && idx.length > 0) {
final int newDims = dims - idx.length;
if (newDims > 0) {
ret = ref.getType().getOuterComponentType().asArrayOf(dims - idx.length);
}
else {
ret = ref.getType().getOuterComponentType();
}
}
else {
ret = ref.getType();
}
return ret;
}
};
代码示例来源:origin: org.jboss.errai/errai-codegen
@Override
public MetaClass getType() {
final MetaClass ret;
final int dims = GenUtil.getArrayDimensions(ref.getType());
if (ref.getType().isArray() && idx.length > 0) {
final int newDims = dims - idx.length;
if (newDims > 0) {
ret = ref.getType().getOuterComponentType().asArrayOf(dims - idx.length);
}
else {
ret = ref.getType().getOuterComponentType();
}
}
else {
ret = ref.getType();
}
return ret;
}
};
代码示例来源:origin: errai/errai
private Object _demarshall(final int dim, final Object arrayInstance, final EJArray a0, final MarshallingSession a1) {
if (dim == 0) {
for (int i = 0; i < a0.size(); i++) {
Array.set(arrayInstance, i, outerMarshaller.demarshall(a0.get(i), a1));
}
}
else {
for (int i = 0; i < a0.size(); i++) {
Array.set(arrayInstance, i, _demarshall(dim - 1,
Array.newInstance(arrayType.getOuterComponentType().asClass(), a0.get(i).isArray().size()),
a0.get(i).isArray(),
a1));
}
}
return arrayInstance;
}
代码示例来源:origin: errai/errai
public static void assertAssignableTypes(final Context context, final MetaClass from, final MetaClass to) {
if (!to.asBoxed().isAssignableFrom(from.asBoxed())) {
if (to.isArray() && from.isArray()
&& GenUtil.getArrayDimensions(to) == GenUtil.getArrayDimensions(from)
&& to.getOuterComponentType().isAssignableFrom(from.getOuterComponentType())) {
return;
}
if (!context.isPermissiveMode()) {
if (classAliases.contains(from.getFullyQualifiedName()) && classAliases.contains(to.getFullyQualifiedName())) {
// handle convertibility between MetaClass API and java Class reference.
return;
}
throw new InvalidTypeException(to.getFullyQualifiedName() + " is not assignable from "
+ from.getFullyQualifiedName());
}
}
}
代码示例来源:origin: org.jboss.errai/errai-marshalling
private Object _demarshall(final int dim, final Object arrayInstance, final EJArray a0, final MarshallingSession a1) {
if (dim == 0) {
for (int i = 0; i < a0.size(); i++) {
Array.set(arrayInstance, i, outerMarshaller.demarshall(a0.get(i), a1));
}
}
else {
for (int i = 0; i < a0.size(); i++) {
Array.set(arrayInstance, i, _demarshall(dim - 1,
Array.newInstance(arrayType.getOuterComponentType().asClass(), a0.get(i).isArray().size()),
a0.get(i).isArray(),
a1));
}
}
return arrayInstance;
}
代码示例来源:origin: org.jboss.errai/errai-codegen
public static void assertAssignableTypes(final Context context, final MetaClass from, final MetaClass to) {
if (!to.asBoxed().isAssignableFrom(from.asBoxed())) {
if (to.isArray() && from.isArray()
&& GenUtil.getArrayDimensions(to) == GenUtil.getArrayDimensions(from)
&& to.getOuterComponentType().isAssignableFrom(from.getOuterComponentType())) {
return;
}
if (!context.isPermissiveMode()) {
if (classAliases.contains(from.getFullyQualifiedName()) && classAliases.contains(to.getFullyQualifiedName())) {
// handle convertibility between MetaClass API and java Class reference.
return;
}
throw new InvalidTypeException(to.getFullyQualifiedName() + " is not assignable from "
+ from.getFullyQualifiedName());
}
}
}
代码示例来源:origin: errai/errai
public static String getVarName(final MetaClass clazz) {
return clazz.isArray()
? getArrayVarName(clazz.getOuterComponentType().getFullyQualifiedName())
+ "_D" + GenUtil.getArrayDimensions(clazz)
: getVarName(clazz.asBoxed().getFullyQualifiedName());
}
代码示例来源:origin: org.jboss.errai/errai-marshalling
public static String getVarName(final MetaClass clazz) {
return clazz.isArray()
? getArrayVarName(clazz.getOuterComponentType().getFullyQualifiedName())
+ "_D" + GenUtil.getArrayDimensions(clazz)
: getVarName(clazz.asBoxed().getFullyQualifiedName());
}
代码示例来源:origin: errai/errai
private int calcBufferSize(final List<MappingDefinition> stack,
final MappingDefinition definition) {
int bufSize = 128;
if (!stack.contains(definition)) {
stack.add(definition);
for (final MemberMapping mapping : definition.getMemberMappings()) {
MappingDefinition def = context.getDefinitionsFactory().getDefinition(mapping.getType());
if (def == null) {
if (mapping.getType().isArray()) {
def = context.getDefinitionsFactory().getDefinition(mapping.getType().getOuterComponentType().asBoxed());
// def could still be null in the case where the array component type is abstract or an
// interface
if (def != null) {
bufSize += (calcBufferSize(stack, def)) * 4;
}
}
continue;
}
bufSize += calcBufferSize(stack, def);
}
}
return bufSize;
}
代码示例来源:origin: errai/errai
@Override
public void addDefinition(final MappingDefinition definition) {
final String fqcn = definition.getMappingClass().getFullyQualifiedName();
final String internalName = definition.getMappingClass().getInternalName();
putDefinitionIfAbsent(fqcn, definition);
if (definition.getMappingClass().isPrimitiveWrapper()) {
putDefinitionIfAbsent(definition.getMappingClass().asUnboxed().getInternalName(), definition);
putDefinitionIfAbsent(definition.getMappingClass().asUnboxed().getFullyQualifiedName(), definition);
}
if (!fqcn.equals(internalName) && definition.getMappingClass().isArray()
&& definition.getMappingClass().getOuterComponentType().isPrimitive()) {
putDefinitionIfAbsent(internalName, definition);
}
if (log.isDebugEnabled())
log.debug("loaded definition: " + fqcn);
}
代码示例来源:origin: org.jboss.errai/errai-marshalling
@Override
public void addDefinition(final MappingDefinition definition) {
final String fqcn = definition.getMappingClass().getFullyQualifiedName();
final String internalName = definition.getMappingClass().getInternalName();
putDefinitionIfAbsent(fqcn, definition);
if (definition.getMappingClass().isPrimitiveWrapper()) {
putDefinitionIfAbsent(definition.getMappingClass().asUnboxed().getInternalName(), definition);
putDefinitionIfAbsent(definition.getMappingClass().asUnboxed().getFullyQualifiedName(), definition);
}
if (!fqcn.equals(internalName) && definition.getMappingClass().isArray()
&& definition.getMappingClass().getOuterComponentType().isPrimitive()) {
putDefinitionIfAbsent(internalName, definition);
}
if (log.isDebugEnabled())
log.debug("loaded definition: " + fqcn);
}
代码示例来源:origin: errai/errai
private void generateMarshallers(final MarshallerGenerationCallback callback) {
final Set<MetaClass> exposed = mappingContext.getDefinitionsFactory().getExposedClasses();
for (final MetaClass clazz : exposed) {
mappingContext.registerGeneratedMarshaller(clazz.getFullyQualifiedName());
}
final boolean lazyEnabled = CommonConfigAttribs.LAZY_LOAD_BUILTIN_MARSHALLERS.getBoolean();
for (final MetaClass cls : exposed) {
final MetaClass compType = cls.getOuterComponentType();
final MappingDefinition definition = mappingContext.getDefinitionsFactory().getDefinition(compType);
if (definition.getClientMarshallerClass() != null || definition.alreadyGenerated()) {
continue;
}
if (target == MarshallerOutputTarget.Java && lazyEnabled && definition.isLazy()) {
if (unlazyMarshallers.contains(compType.getFullyQualifiedName())) {
definition.setLazy(false);
}
else {
continue;
}
}
addMarshaller(compType);
callback.callback(compType);
}
}
内容来源于网络,如有侵权,请联系作者删除!