本文整理了Java中groovy.lang.MetaClass.getMetaProperty()
方法的一些代码示例,展示了MetaClass.getMetaProperty()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MetaClass.getMetaProperty()
方法的具体详情如下:
包路径:groovy.lang.MetaClass
类名称:MetaClass
方法名:getMetaProperty
暂无
代码示例来源:origin: org.codehaus.groovy/groovy
public MetaProperty getMetaProperty(String name) {
return this.delegate.getMetaProperty(name);
}
代码示例来源:origin: org.codehaus.groovy/groovy
private static MetaBeanProperty getMetaPropertyFromMutableMetaClass(String propertyName, MetaClass metaClass) {
final boolean isModified = ((MutableMetaClass) metaClass).isModified();
if (isModified) {
final MetaProperty metaProperty = metaClass.getMetaProperty(propertyName);
if(metaProperty instanceof MetaBeanProperty)
return (MetaBeanProperty)metaProperty;
}
return null;
}
代码示例来源:origin: org.codehaus.groovy/groovy
public MetaProperty getMetaProperty(String name) {
final Object owner = getOwner();
final MetaClass ownerMetaClass = getOwnerMetaClass(owner);
return ownerMetaClass.getMetaProperty(name);
}
代码示例来源:origin: spockframework/spock
@Override
public ISlot create(Object owner, Type ownerType, String name) {
MetaProperty property = GroovyRuntimeUtil.getMetaClass(owner).getMetaProperty(name);
return property != null && MopUtil.isWriteable(property) ? new PropertySlot(owner, ownerType, property) : null;
}
}
代码示例来源:origin: spockframework/spock
@Override
public ISlot create(Object owner, Type ownerType, String name) {
String plural = toPluralForm(name);
MetaProperty property = GroovyRuntimeUtil.getMetaClass(owner).getMetaProperty(plural);
return property != null && Collection.class.isAssignableFrom(property.getType()) && MopUtil.isReadable(property) ?
new CollectionSlot(plural, owner, ownerType, property) : null;
}
代码示例来源:origin: org.codehaus.groovy/groovy
final List<MetaProperty> propList = metaClass.getProperties();
for (MetaProperty prop : propList)
if (self.getMetaProperty(prop.getName()) == null) {
mc.registerBeanProperty(prop.getName(), new MixinInstanceMetaProperty(prop, mixin));
if (self.getMetaProperty(prop.getName()) == null) {
mc.registerBeanProperty(prop.getName(), new MixinInstanceMetaProperty(prop, mixin));
代码示例来源:origin: org.codehaus.groovy/groovy-all-minimal
private MetaBeanProperty getMetaPropertyFromMutableMetaClass(String propertyName, MetaClass metaClass) {
final boolean isModified = ((MutableMetaClass) metaClass).isModified();
final MetaProperty metaProperty = metaClass.getMetaProperty(propertyName);
if(metaProperty instanceof MetaBeanProperty)
return isModified ? (MetaBeanProperty)metaProperty : null;
else
return null;
}
代码示例来源:origin: org.grails/grails-datastore-gorm
private static EventTriggerCaller resolveMetaPropertyClosureCaller(String eventMethodName, MetaClass metaClass) {
MetaProperty metaProperty = metaClass.getMetaProperty(eventMethodName);
if (metaProperty != null) {
return new MetaPropertyClosureCaller(metaProperty);
}
return null;
}
代码示例来源:origin: org.kohsuke.droovy/groovy
private MetaBeanProperty getMetaPropertyFromMutableMetaClass(String propertyName, MetaClass metaClass) {
final boolean isModified = ((MutableMetaClass) metaClass).isModified();
if (isModified) {
final MetaProperty metaProperty = metaClass.getMetaProperty(propertyName);
if(metaProperty instanceof MetaBeanProperty)
return (MetaBeanProperty)metaProperty;
}
return null;
}
代码示例来源:origin: org.gradle/gradle-core
@Nullable
protected MetaProperty lookupProperty(MetaClass metaClass, String name) {
if (metaClass instanceof MetaClassImpl) {
try {
return (MetaProperty) META_PROP_METHOD.invoke(metaClass, name, false);
} catch (Throwable e) {
throw UncheckedException.throwAsUncheckedException(e);
}
}
// Some other meta-class implementation - fall back to the public API
return metaClass.getMetaProperty(name);
}
代码示例来源:origin: org.grails/grails-datastore-core
public PropertyDescriptor getPropertyDescriptor(String name) {
MetaProperty property = theMetaClass.getMetaProperty(name);
if(property != null) {
return createPropertyDescriptor(clazz, property);
}
return null;
}
代码示例来源:origin: org.codehaus.groovy/groovy-jdk14
private MetaBeanProperty getMetaPropertyFromMutableMetaClass(String propertyName, MetaClass metaClass) {
final boolean isModified = ((MutableMetaClass) metaClass).isModified();
if (isModified) {
final MetaProperty metaProperty = metaClass.getMetaProperty(propertyName);
if(metaProperty instanceof MetaBeanProperty)
return (MetaBeanProperty)metaProperty;
}
return null;
}
代码示例来源:origin: com.thinkaurelius.groovy-shaded-asm/groovy-shaded-asm
private MetaBeanProperty getMetaPropertyFromMutableMetaClass(String propertyName, MetaClass metaClass) {
final boolean isModified = ((MutableMetaClass) metaClass).isModified();
if (isModified) {
final MetaProperty metaProperty = metaClass.getMetaProperty(propertyName);
if(metaProperty instanceof MetaBeanProperty)
return (MetaBeanProperty)metaProperty;
}
return null;
}
代码示例来源:origin: org.gradle/gradle-core
@Nullable
@Override
protected MetaProperty lookupProperty(MetaClass metaClass, String name) {
MetaProperty metaProperty = super.lookupProperty(metaClass, name);
if (metaProperty != null) {
return metaProperty;
}
metaProperty = classMetaData.getMetaProperty(name);
if (metaProperty != null && Modifier.isStatic(metaProperty.getModifiers())) {
return metaProperty;
}
return null;
}
代码示例来源:origin: org.grails/grails-datastore-core
public boolean isReadableProperty(String name) {
MetaProperty metaProperty = theMetaClass.getMetaProperty(name);
if(metaProperty instanceof MetaBeanProperty) {
MetaBeanProperty metaBeanProperty = (MetaBeanProperty) metaProperty;
return metaBeanProperty.getField() != null || metaBeanProperty.getGetter() != null;
}
return false;
}
代码示例来源:origin: com.thinkaurelius.groovy-shaded-asm/groovy-shaded-asm
public MetaProperty getMetaProperty(String name) {
final Object owner = getOwner();
final MetaClass ownerMetaClass = getOwnerMetaClass(owner);
return ownerMetaClass.getMetaProperty(name);
}
代码示例来源:origin: org.codehaus.groovy/groovy-jdk14
public MetaProperty getMetaProperty(String name) {
final Object owner = getOwner();
final MetaClass ownerMetaClass = getOwnerMetaClass(owner);
return ownerMetaClass.getMetaProperty(name);
}
代码示例来源:origin: org.grails/grails-datastore-core
private static Object getStaticPropertyValue(MetaClass theMetaClass, String name) {
MetaProperty metaProperty = theMetaClass.getMetaProperty(name);
if(metaProperty != null && Modifier.isStatic(metaProperty.getModifiers())) {
return metaProperty.getProperty(theMetaClass.getTheClass());
}
return null;
}
代码示例来源:origin: org.grails/grails-datastore-core
public static Class<?> getPropertyType(Class<?> cls, String propertyName) {
MetaProperty metaProperty = GroovySystem.getMetaClassRegistry().getMetaClass(cls).getMetaProperty(propertyName);
if(metaProperty != null) {
return metaProperty.getType();
}
return null;
}
代码示例来源:origin: org.codehaus.groovyfx/groovyfx
static public boolean isJavaBeanPropertyWritable(Object instance, String propertyName) {
MetaClass mc = InvokerHelper.getMetaClass(instance);
MetaProperty metaProperty = mc.getMetaProperty(propertyName);
if(metaProperty != null) {
String setterName = MetaProperty.getSetterName(propertyName);
return !mc.respondsTo(instance, setterName, new Class[]{metaProperty.getType()}).isEmpty();
} else if(instance instanceof Script) {
return ((Script)instance).getProperty(propertyName) != null;
}
return false;
}
内容来源于网络,如有侵权,请联系作者删除!