本文整理了Java中org.jboss.errai.codegen.meta.MetaClass.getInternalName()
方法的一些代码示例,展示了MetaClass.getInternalName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MetaClass.getInternalName()
方法的具体详情如下:
包路径:org.jboss.errai.codegen.meta.MetaClass
类名称:MetaClass
方法名:getInternalName
暂无
代码示例来源:origin: errai/errai
public static int getArrayDimensions(final MetaClass type) {
if (!type.isArray()) return 0;
final String internalName = type.getInternalName();
for (int i = 0; i < internalName.length(); i++) {
if (internalName.charAt(i) != '[') return i;
}
return 0;
}
代码示例来源:origin: org.jboss.errai/errai-codegen
public static int getArrayDimensions(final MetaClass type) {
if (!type.isArray()) return 0;
final String internalName = type.getInternalName();
for (int i = 0; i < internalName.length(); i++) {
if (internalName.charAt(i) != '[') return i;
}
return 0;
}
代码示例来源:origin: errai/errai
@Override
public MappingDefinition getDefinition(final MetaClass clazz) {
MappingDefinition def = getDefinition(clazz.getFullyQualifiedName());
if (def == null) {
def = getDefinition(clazz.getInternalName());
}
return def;
}
代码示例来源:origin: org.jboss.errai/errai-marshalling
@Override
public MappingDefinition getDefinition(final MetaClass clazz) {
MappingDefinition def = getDefinition(clazz.getFullyQualifiedName());
if (def == null) {
def = getDefinition(clazz.getInternalName());
}
return def;
}
代码示例来源:origin: errai/errai
public static String methodAccess(final MetaMethod method) {
final StringBuilder buf = new StringBuilder(50);
if (!method.getReturnType().isVoid()) {
buf.append("return ");
}
if (!method.isStatic()) {
buf.append("instance.");
}
buf.append('@').append(method.getDeclaringClass().getFullyQualifiedName().replace('$', '.'))
.append("::").append(method instanceof MetaConstructor ? "new" : method.getName()).append('(');
for (final MetaParameter parm : method.getParameters()) {
buf.append(parm.getType().getInternalName());
}
buf.append(")(");
final int length = method.getParameters().length;
for (int i = 0; i < length; i++) {
buf.append("a").append(i);
if (i + 1 < length) buf.append(",");
}
buf.append(")");
return buf.toString();
}
}
代码示例来源:origin: org.jboss.errai/errai-codegen-gwt
public static String methodAccess(final MetaMethod method) {
final StringBuilder buf = new StringBuilder(50);
if (!method.getReturnType().isVoid()) {
buf.append("return ");
}
if (!method.isStatic()) {
buf.append("instance.");
}
buf.append('@').append(method.getDeclaringClass().getFullyQualifiedName().replace('$', '.'))
.append("::").append(method instanceof MetaConstructor ? "new" : method.getName()).append('(');
for (final MetaParameter parm : method.getParameters()) {
buf.append(parm.getType().getInternalName());
}
buf.append(")(");
final int length = method.getParameters().length;
for (int i = 0; i < length; i++) {
buf.append("a").append(i);
if (i + 1 < length) buf.append(",");
}
buf.append(")");
return buf.toString();
}
}
代码示例来源: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
@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
@Test
public void testInternalNameForMultiDimensionalPrimitiveArray() {
final String internalName = getMetaClass(char[][].class).getInternalName();
assertEquals("Wrong internal name generated for multidimensional primitive array",
"[[C", internalName);
}
代码示例来源:origin: errai/errai
@Test
public void testInternalNameForOneDimensionalPrimitiveArray() {
final String internalName = getMetaClass(char[].class).getInternalName();
assertEquals("Wrong internal name generated for one-dimensional primitive array",
"[C", internalName);
}
代码示例来源:origin: errai/errai
@Test
public void testInternalNameForOneDimensionalObjectArray() {
final String internalName = getMetaClass(String[].class).getInternalName();
assertEquals("Wrong internal name generated for one-dimensional object array",
"[Ljava/lang/String;", internalName);
}
代码示例来源:origin: errai/errai
@Test
public void testInternalNameForMultiDimensionalObjectArray() {
final String internalName = getMetaClass(String[][].class).getInternalName();
assertEquals("Wrong internal name generated for multidimensional object array",
"[[Ljava/lang/String;", internalName);
}
代码示例来源:origin: errai/errai
@Test
public void testNamingMethods() throws Exception {
final MetaClass child = getMetaClass(Child.class);
assertEquals(Child.class.getSimpleName(), child.getName());
assertEquals(Child.class.getName(), child.getFullyQualifiedName());
assertEquals(Child.class.getName(), child.getCanonicalName());
assertEquals("L" + Child.class.getName().replace('.', '/') + ";", child.getInternalName());
}
代码示例来源:origin: errai/errai
private void addArrayMarshaller(final MetaClass type) {
MetaClass compType = type.getOuterComponentType().asBoxed();
if (!factory.hasDefinition(type.getFullyQualifiedName())
&& !factory.hasDefinition(type.getInternalName())) {
MappingDefinition outerDef = factory.getDefinition(compType);
Marshaller<Object> marshaller;
if (outerDef != null && !factory.shouldUseObjectMarshaller(compType)) {
marshaller = outerDef.getMarshallerInstance();
}
else {
compType = MetaClassFactory.get(Object.class);
marshaller = factory.getDefinition(Object.class).getMarshallerInstance();
}
if (marshaller == null) {
throw new MarshallingException("Failed to generate array marshaller for " + type.getCanonicalName() +
" because marshaller for " + compType + " could not be found.");
}
MappingDefinition newDef = new MappingDefinition(
EncDecUtil.qualifyMarshaller(
new DefaultArrayMarshaller(type, marshaller),
(Class<Object>) type.asClass()
), type, true);
if (outerDef != null) {
newDef.setClientMarshallerClass(outerDef.getClientMarshallerClass());
}
factory.addDefinition(newDef);
}
}
代码示例来源:origin: org.jboss.errai/errai-marshalling
private void addArrayMarshaller(final MetaClass type) {
MetaClass compType = type.getOuterComponentType().asBoxed();
if (!factory.hasDefinition(type.getFullyQualifiedName())
&& !factory.hasDefinition(type.getInternalName())) {
MappingDefinition outerDef = factory.getDefinition(compType);
Marshaller<Object> marshaller;
if (outerDef != null && !factory.shouldUseObjectMarshaller(compType)) {
marshaller = outerDef.getMarshallerInstance();
}
else {
compType = MetaClassFactory.get(Object.class);
marshaller = factory.getDefinition(Object.class).getMarshallerInstance();
}
if (marshaller == null) {
throw new MarshallingException("Failed to generate array marshaller for " + type.getCanonicalName() +
" because marshaller for " + compType + " could not be found.");
}
MappingDefinition newDef = new MappingDefinition(
EncDecUtil.qualifyMarshaller(
new DefaultArrayMarshaller(type, marshaller),
(Class<Object>) type.asClass()
), type, true);
if (outerDef != null) {
newDef.setClientMarshallerClass(outerDef.getClientMarshallerClass());
}
factory.addDefinition(newDef);
}
}
内容来源于网络,如有侵权,请联系作者删除!