Package jfun.yan

Examples of jfun.yan.Component


  public void setInterfaces(Class[] types){
    checkDuplicate("type", itfs);
    this.itfs = types;
  }
  public Component eval(){
    final Component cc = getComponent();
    checkMandatory("component", cc);
    if(itfs!=null)
      return cc.proxy(itfs);
    else
      return cc.proxy();
  }
View Full Code Here


    this.of = of;
  }

  public Component eval() throws Exception {
    checkMandatory("class", of);
    final Component cc = getMandatory();
    return cc.map(new Map(){
      public Object map(Object obj){
        return Boolean.valueOf(ReflectionUtil.isInstance(of, obj));
      }
    }).cast(boolean.class);
  }
View Full Code Here

      public Object map(Object o1, Object o2){
        assertion(o1, o2);
        return Components.value(null);
      }
    };
    final Component c1 = getComponent1();
    final Component c2 = getComponent2();
    return Monad.map(c1, c2, cmp);
    /*assertion(getVal1(), getVal2());
    return Components.value(true);*/
  }
View Full Code Here

  public void setType(Class itf) {
    this.itf = itf;
  }

  public Component eval(){
    final Component proxied = getMandatory();
    return InjectorNut.helper
    .getProxyComponentReturningInjected(getComponentClassLoader(),
        itf, proxied, injectee, injection);
  }
View Full Code Here

* Nov 10, 2005 12:01:47 AM
*/
public class IfElseNut extends ConditionalNut {
  public Component eval(){
    final boolean c = isCond();
    final Component then = getThen();
    checkMandatory("then", then);
    if(c)
      return then;
    else{
      final Component alt = getElse();
      return alt==null?Components.value(false):alt;
    }
  }
View Full Code Here

* Nov 10, 2005 12:01:47 AM
*/
public class UnlessNut extends ConditionalNut {
  public Component eval(){
    final boolean c = isCond();
    final Component then = getThen();
    checkMandatory("then", then);
    if(!c)
      return then;
    else{
      final Component alt = getElse();
      return alt==null?Components.value(true):alt;
    }
  }
View Full Code Here

  public void setKey(Object key) {
    this.key = key;
  }

  public Component eval(){
    final Component cc = getComponent();
    checkMandatory("key", key);
    checkMandatory("component", cc);
    final Class type = cc.getType();
    if(type!=null &&
        !jfun.yan.util.Utils.isCompatible(Map.class, cc)
    ){
      throw raise("cannot call get against "+
          Misc.getTypeName(type));
View Full Code Here

    final String last = parts[parts.length-1];
    return getGetter1(c, last, ind);
  }
  public Component eval()
  throws IntrospectionException{
    final Component component = getComponent();
    checkMandatory("component", component);
    checkMandatory("name", name);
    return getGetterComponent(component, name, ind);
  }
View Full Code Here

      throw raise("the number of ids should be the same as the number of vals. "+ids.length
          + "!="+vals.length);
    }
    for(int i=0; i<ids.length; i++){
      final Object id = ids[i];
      final Component val = vals[i];
      super.registerValue(id, val);
    }
  }
View Full Code Here

    public static class B {
    }

    public void testAllUnsatisfiableDependenciesAreSignalled()
    throws IntrospectionException{
        Component aAdapter =
          Components.bean(A.class);
        //new SetterInjectionComponentAdapter("a", A.class, null);
        Component bAdapter =
          Components.bean(B.class).singleton();
          //new SetterInjectionComponentAdapter("b", B.class, null);

        Container yan = new DefaultContainer();
        yan.verify();
View Full Code Here

TOP

Related Classes of jfun.yan.Component

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.