use of lucee.runtime.component.Member in project Lucee by lucee.
the class ComponentImpl method get.
/**
* @param access
* @param key
* @param defaultValue
* @return
*/
public Object get(int access, Collection.Key key, Object defaultValue) {
Member member = getMember(access, key, true, false);
if (member != null)
return member.getValue();
// trigger
PageContext pc = ThreadLocalPageContext.get();
if (triggerDataMember(pc) && !isPrivate(pc)) {
return callGetter(pc, key, defaultValue);
}
return defaultValue;
}
use of lucee.runtime.component.Member in project Lucee by lucee.
the class ComponentImpl method get.
public Object get(int access, Collection.Key key) throws PageException {
Member member = getMember(access, key, true, false);
if (member != null)
return member.getValue();
// Trigger
PageContext pc = ThreadLocalPageContext.get();
if (triggerDataMember(pc) && !isPrivate(pc)) {
return callGetter(pc, key);
}
throw new ExpressionException("Component [" + getCallName() + "] has no accessible Member with name [" + key + "]");
}
use of lucee.runtime.component.Member in project Lucee by lucee.
the class ComponentImpl method getMembers.
/*protected Set<Key> udfKeySet(int access) {
Set<Key> set=new HashSet<Key>();
Member m;
Map.Entry<Key, UDF> entry;
Iterator<Entry<Key, UDF>> it = _udfs.entrySet().iterator();
while(it.hasNext()) {
entry= it.next();
m=entry.getValue();
if(m.getAccess()<=access)set.add(entry.getKey());
}
return set;
}*/
protected java.util.List<Member> getMembers(int access) {
java.util.List<Member> members = new ArrayList<Member>();
Member e;
Iterator<Entry<Key, Member>> it = _data.entrySet().iterator();
while (it.hasNext()) {
e = it.next().getValue();
if (e.getAccess() <= access)
members.add(e);
}
return members;
}
use of lucee.runtime.component.Member in project Lucee by lucee.
the class ComponentScopeShadow method callWithNamedValues.
/*public Object callWithNamedValues(PageContext pc, String key,Struct args) throws PageException {
return callWithNamedValues(pc, KeyImpl.init(key), args);
}*/
@Override
public Object callWithNamedValues(PageContext pc, Key key, Struct args) throws PageException {
// first check variables
Object o = shadow.get(key);
if (o instanceof UDFPlus) {
return ((UDFPlus) o).callWithNamedValues(pc, key, args, false);
}
Member m = component.getMember(access, key, false, false);
if (m != null) {
if (m instanceof UDFPlus)
return ((UDFPlus) m).callWithNamedValues(pc, key, args, false);
return MemberUtil.callWithNamedValues(pc, this, key, args, CFTypes.TYPE_STRUCT, "struct");
// throw ComponentUtil.notFunction(component, key, m.getValue(),access);
}
return MemberUtil.callWithNamedValues(pc, this, key, args, CFTypes.TYPE_STRUCT, "struct");
// throw ComponentUtil.notFunction(component, key, null,access);
}
use of lucee.runtime.component.Member in project Lucee by lucee.
the class ComponentScopeShadow method call.
/*public Object call(PageContext pc, String key, Object[] arguments) throws PageException {
return call(pc, KeyImpl.init(key), arguments);
}*/
@Override
public Object call(PageContext pc, Collection.Key key, Object[] arguments) throws PageException {
// first check variables
Object o = shadow.get(key);
if (o instanceof UDFPlus) {
return ((UDFPlus) o).call(pc, key, arguments, false);
}
// then check in component
Member m = component.getMember(access, key, false, false);
if (m != null) {
if (m instanceof UDFPlus)
return ((UDFPlus) m).call(pc, key, arguments, false);
}
return MemberUtil.call(pc, this, key, arguments, new short[] { CFTypes.TYPE_STRUCT }, new String[] { "struct" });
// throw ComponentUtil.notFunction(component, key, m!=null?m.getValue():null,access);
}
Aggregations