Examples of Named


Examples of com.google.inject.name.Named

          continue;
        }
        for (final Annotation annotation : annotations[index]) {
          final Class<? extends Annotation> clazz = annotation.annotationType();
          if (clazz.equals(Named.class)) {
            final Named named = (Named) annotation;
            getNamedParameters().put(named.value(), para);
            continue label1;
          } else if (clazz.equals(FirstResult.class)) {
            firstResult = (Integer) para;
            continue label1;
          } else if (clazz.equals(MaxResults.class)) {
View Full Code Here

Examples of com.google.inject.name.Named

   * @return
   */
  private Object propertyResult(Object[] parameters) {
    EntityManager em = getContext().getEntityManager();
    Annotation[][] annos = method.getParameterAnnotations();
    Named named = null;
    for (Annotation a : annos[0]) {
      final Class<? extends Annotation> clazz = a.annotationType();
      if (clazz.equals(Named.class)) {
        named = (Named) a;
      }
    }
    if (named == null)
      return em.find(getMethodReturnType(), parameters[0]);
    else {
      String ejbql = "from " + getMethodReturnType().getSimpleName() + " entity where entity." + named.value()
              + "=?";
      Query query = em.createQuery(ejbql);
      query.setParameter(1, parameters[0]);
      return query.getSingleResult();
    }
View Full Code Here

Examples of com.google.inject.name.Named

        continue;
      }
      for (final Annotation annotation : annotations[index]) {
        final Class<? extends Annotation> clazz = annotation.annotationType();
        if (clazz.equals(Named.class)) {
          final Named named = (Named) annotation;
          getNamedParameters().put(named.value(), para);
          continue label1;
        } else if (clazz.equals(FirstResult.class)) {
          firstResult = (Integer) para;
          continue label1;
        } else if (clazz.equals(MaxResults.class)) {
View Full Code Here

Examples of com.google.inject.name.Named

  public boolean equals(Object o) {
    if (!(o instanceof Named)) {
      return false;
    }

    Named other = (Named) o;
    return value.equals(other.value());
  }
View Full Code Here

Examples of com.uic.ase.proj.xbn.named.Named

    <P>Get the Named object's <I>name</I>, at the requested array index.</P>

    @return  <CODE>(Named)<A HREF="#getNamed(int)">getNamed</A>(i_dx).<A HREF="~JD~n~EJD~#getName()">getName</A>()</CODE>
   **/
  public final String getString(int i_dx)  {
    Named n = getNamed(i_dx);

    try  {
      return n.getName();
    catch(NullPointerException npx)  {
      throwAX("get:  isNull(" + i_dx + ") equals true.");
    }

    //Never reached.  Required for compile.
View Full Code Here

Examples of com.volantis.mcs.build.themes.definitions.Named

            addTypeDef(typeDef);

        } else if (name.equals("name")) {

            // Set the name of the containing named object.
            Named named = (Named) findObject(Named.class);
            named.setName(element.getText());

        } else if (name.equals("description")) {
            // Ignore description elements and their contents, they have no
            // effect on code generation.
        } else if (name.equals("initialValue")) {

            processInitialValue(element);

        } else if (name.equals("integerValue")) {
            String valStr = element.getText();
            try {
                int intVal = Integer.parseInt(valStr);
                IntegerValue value = definitionsFactory.createIntegerValue();
                value.setInteger(intVal);
                ValueContainer container =
                        (ValueContainer) findObject(ValueContainer.class);
                container.addValue(value);
            } catch (NumberFormatException nfe) {
                System.out.println("Invalid number: '" + valStr + "'");
            }
        } else if (name.equals("lengthValue")) {
            String valStr = element.getText();
            try {
                int intVal = Integer.parseInt(valStr);
                LengthValue value = definitionsFactory.createLengthValue();
                value.setInteger(intVal);
                value.setUnits(element.getAttributeValue("units"));
                ValueContainer container =
                        (ValueContainer) findObject(ValueContainer.class);
                container.addValue(value);
            } catch (NumberFormatException nfe) {
                System.out.println("Invalid number: '" + valStr + "'");
            }
        } else if (name.equals("angleValue")) {
            String valStr = element.getText();

            try {
                double doubleVal = Double.parseDouble(valStr);
                String units = element.getAttributeValue("units");
                ValueContainer container =
                        (ValueContainer) findObject(ValueContainer.class);
                AngleValue value = definitionsFactory.createAngleValue();
                value.setAngle(doubleVal);
                value.setUnits(units);
                container.addValue(value);
            } catch (NumberFormatException nfe) {
                System.out.println("Invalid angle: '" + valStr + "'");
            }
        } else if (name.equals("stringValue")) {
            ValueContainer container =
                    (ValueContainer) findObject(ValueContainer.class);
            StringValue value = definitionsFactory.createStringValue();
            value.setString(element.getText());
            container.addValue(value);
        } else if (name.equals("colorValue")) {
            ValueContainer container =
                    (ValueContainer) findObject(ValueContainer.class);
            ColorValue value = definitionsFactory.createColorValue();
            value.setColorName(element.getText());
            container.addValue(value);
        } else if (name.equals("inheritValue")) {
            ValueContainer container =
                    (ValueContainer) findObject(ValueContainer.class);
            InheritValue value = definitionsFactory.createInheritValue();
            container.addValue(value);
        } else if (name.equals("percentageValue")) {
            String valStr = element.getText();
            try {
                double percentVal = Double.parseDouble(valStr);
                PercentageValue value =
                        definitionsFactory.createPercentageValue();
                value.setPercentage(percentVal);
                ValueContainer container =
                        (ValueContainer) findObject(ValueContainer.class);
                container.addValue(value);
            } catch (NumberFormatException nfe) {
                System.out.println("Invalid percentage: '" + valStr + "'");
            }
        } else if (name.equals("timeValue")) {
            String valStr = element.getText();

            try {
                double doubleVal = Double.parseDouble(valStr);
                String units = element.getAttributeValue("units");
                ValueContainer container =
                        (ValueContainer) findObject(ValueContainer.class);
                TimeValue value = definitionsFactory.createTimeValue();
                value.setTime(doubleVal);
                value.setUnits(units);
                container.addValue(value);
            } catch (NumberFormatException nfe) {
                System.out.println("Invalid time: '" + valStr + "'");
            }
        } else if (name.equals("pairValue")) {
            PairValueContainer pair = new PairValueContainer();

            pushObject(pair);
            processThemePropertyChildren(element);
            popObject();

            PairValue value = definitionsFactory.createPairValue();
            value.setFirst(pair.getFirst());
            value.setSecond(pair.getSecond());

            ValueContainer container =
                    (ValueContainer) findObject(ValueContainer.class);
            container.addValue(value);
        } else if (name.equals("listValue")) {
            ListValueContainer pair = new ListValueContainer();

            pushObject(pair);
            processThemePropertyChildren(element);
            popObject();

            ListValue value = definitionsFactory.createListValue();
            Value next = null;
            while((next = pair.getNext())!=null){
                value.setNext(next);
            }
           
            ValueContainer container =
                    (ValueContainer) findObject(ValueContainer.class);
            container.addValue(value);
        } else if (name.equals("frequencyValue")) {
            String valStr = element.getText();

            try {
                double doubleVal = Double.parseDouble(valStr);
                String units = element.getAttributeValue("units");
                ValueContainer container =
                        (ValueContainer) findObject(ValueContainer.class);
                FrequencyValue value = definitionsFactory.createFrequencyValue();
                value.setNumber(doubleVal);
                value.setUnits(units);
                container.addValue(value);
            } catch (NumberFormatException nfe) {
                System.out.println("Invalid frequency: '" + valStr + "'");
            }
        } else if (name.equals("fractionValue")) {
            PairValueContainer pair = new PairValueContainer();

            pushObject(pair);
            processThemePropertyChildren(element);
            popObject();

            FractionValue value = definitionsFactory.createFractionValue();
            value.setNumerator(pair.getFirst());
            value.setDenominator(pair.getSecond());

            ValueContainer container =
                    (ValueContainer) findObject(ValueContainer.class);
            container.addValue(value);
        } else if (name.equals("keywordRef")) {

            // Resolve the keyword reference to the keyword (must come before)
            // and then create a representation.
            ValueContainer container =
                    (ValueContainer) findObject(ValueContainer.class);
            String keywordName = element.getText();

            // Get the keyword from the property's type.
            Property property = (Property) findObject(Property.class);
            Type type = property.getType();
            if (type != null) {
                KeywordSearchContainer keywordCont =
                        new KeywordSearchContainer();
                keywordCont.setKeywordName(keywordName);
                TypeVisitor keywordFinder = new AbstractTypeVisitor() {
                    public void visitKeywords(Keywords visitee, Object obj) {
                        KeywordSearchContainer ksc =
                                (KeywordSearchContainer) obj;
                        Keyword keyword =
                                visitee.getKeyword(ksc.getKeywordName());
                        if (keyword != null) {
                            ksc.setKeyword(keyword);
                        }
                    }

                    public void visitTypeRef(TypeRef visitee, Object obj) {
                        TypeDefinition td = getTypeDef(visitee.getReference());
                        if (td != null) {
                            Type t = td.getType();
                            if (t != null) {
                                t.accept(this, obj);
                            }
                        }
                    }
                };
                type.accept(keywordFinder, keywordCont);
                if (keywordCont.getKeyword() == null) {
                    System.out.println("Keyword " + keywordName
                                       + " not found in property "
                                       + property.getName());
                } else {
                    KeywordReference reference
                            = definitionsFactory.createKeywordReference();
                    reference.setKeyword(keywordCont.getKeyword());
                    container.addValue(reference);
                }
            } else {
                System.out.println(
                        "Property has no type: could not find keywords");
            }
        } else if (name.equals("themeDefinition")) {
            // Process all the children.
            processThemePropertyChildren(element);
        } else if (name.equals("choiceType")) {
            ChoiceType choiceType = definitionsFactory.createChoiceType();
            TypeList typeList = new TypeList();

            pushObject(choiceType);
            pushObject(typeList);
            processThemePropertyChildren(element);
            popObject();
            popObject();

            Iterator it = typeList.getList().iterator();
            while (it.hasNext()) {
                choiceType.addType((Type) it.next());
            }
            storeType(choiceType);
        } else if (name.equals("pairType")) {
            PairType pairType = definitionsFactory.createPairType();

            pushObject(pairType);
            processThemePropertyChildren(element);
            popObject();

            storeType(pairType);
        } else if (name.equals("fractionType")) {
            FractionType fractionType = definitionsFactory.createFractionType();

            pushObject(fractionType);
            processThemePropertyChildren(element);
            popObject();
            storeType(fractionType);
        } else if (name.equals("first")) {
            TypeList typeList = new TypeList();
            NameHolder nameHolder = new NameHolder();

            pushObject(typeList);
            pushObject(nameHolder);
            processThemePropertyChildren(element);
            popObject();
            popObject();

            if (!typeList.getList().isEmpty()) {
                PairType pair = (PairType) findObject(PairType.class);
                pair.setFirst((Type) typeList.getList().get(0));
            }
        } else if (name.equals("second")) {
            TypeList typeList = new TypeList();
            NameHolder nameHolder = new NameHolder();

            pushObject(typeList);
            pushObject(nameHolder);
            processThemePropertyChildren(element);
            popObject();
            popObject();

            if (!typeList.getList().isEmpty()) {
                PairType pair = (PairType) findObject(PairType.class);
                pair.setSecond((Type) typeList.getList().get(0));
            }
        } else if (name.equals("numerator")) {
            TypeList typeList = new TypeList();
            NameHolder nameHolder = new NameHolder();

            pushObject(typeList);
            pushObject(nameHolder);
            processThemePropertyChildren(element);
            popObject();
            popObject();

            if (!typeList.getList().isEmpty()) {
                FractionType fraction = (FractionType) findObject(FractionType.class);
                fraction.setNumerator((Type) typeList.getList().get(0));
            }
        } else if (name.equals("denominator")) {
            TypeList typeList = new TypeList();
            NameHolder nameHolder = new NameHolder();

            pushObject(typeList);
            pushObject(nameHolder);
            processThemePropertyChildren(element);
            popObject();
            popObject();

            if (!typeList.getList().isEmpty()) {
                FractionType fraction = (FractionType) findObject(FractionType.class);
                fraction.setDenominator((Type) typeList.getList().get(0));
            }
        }else if (name.equals("type")) {
            // Process the children in order to find the keyword definitions.
            processThemePropertyChildren(element);
        } else if (name.equals("typeRef")) {

            TypeRef typeRef = definitionsFactory.createTypeRef();
            typeRef.setReference(element.getText());
            Property property = (Property) findObject(Property.class);
            property.setType(typeRef);

        } else if (name.equals("keywords")) {

            Keywords keywords = definitionsFactory.createKeywords();

            pushObject(keywords);
            processThemePropertyChildren(element);
            popObject();

            storeType(keywords);

        } else if (name.equals("keyword")) {

            // Define a new keyword and add it into the containing set.
            Keyword keyword = definitionsFactory.createKeyword();

            pushObject(keyword);

            processThemePropertyChildren(element);

            popObject();

            Keywords keywords = (Keywords) findObject(Keywords.class);
            keywords.addKeyword(keyword);
        } else if (name.equals("inherited")) {
            Property prop = (Property) findObject(Property.class);
            prop.setInherited(
                    Boolean.valueOf(element.getText()).booleanValue());
            // These are named elements that we are deliberately ignoring for
            // the time being.
        } else if (name.equals("element") ||
                name.equals("media") ||
                name.equals("specifications") ||
                name.equals("integerType") ||
                name.equals("colorType") ||
                name.equals("percentageType") ||
                name.equals("lengthType") ||
                name.equals("uriType") ||
                name.equals("mcsComponentURIType") ||
                name.equals("appliesTo") ||
                name.equals("percentages") ||
                name.equals("stringType") ||
                name.equals("dependentType") ||
                name.equals("angleType") ||
                name.equals("functionType") ||
                name.equals("timeType") ||
                name.equals("numberType") ||
                name.equals("fractionType") ||
                name.equals("frequencyType") ||
                name.equals("emptyList") ||
                // From discussion with Paul Duffin, unorderedSetType is being
                // phased out, and can be safely ignored since it is only used
                // in one case, and there the initialValue falls outside the
                // unorderedSetType.
                name.equals("unorderedSetType") ||
                // Dependent values - such as color, text alignment etc. -
                // depend on some value outside of the scope of the property
                // definitions (such as the user agent or the writing
                // direction). A generic 'initial value' can not be
                // calculated for them.
                name.equals("dependentValue")) {
            // These are types which contain a single other type - lists and
            // ordered sets. Rather than creating a simple type that can contain
            // another type, they can be ignored, allowing the type tree to be
            // navigated without adding an additional (non-functional) layer.
        } else if (name.equals("listType") ||
                name.equals("orderedSetType")) {
            processThemePropertyChildren(element);
        } else if (name.equals("propertyRef")) {
            // This only works inside initialValue.
            PropertyReference reference = (PropertyReference)
                    findObject(PropertyReference.class);
            String propertyName = element.getText();
            if (reference == null) {
                System.out.println("Ignoring reference to property '" +
                                   propertyName + "'");
            } else {
                reference.setPropertyName(propertyName);
            }
        } else if (name.equals("computedRef")) {
            // This only works inside initialValue.
            ComputedReference reference = (ComputedReference)
                findObject(ComputedReference.class);
            if (reference == null) {
                System.out.println("Ignoring reference to computedRef");
            } else {

                Named propertyName = definitionsFactory.createProperty();
                pushObject(propertyName);
                Rules rules = definitionsFactory.createRules();
                pushObject(rules);
                processThemePropertyChildren(element);
                popObject();
                popObject();

                reference.setPropertyName(propertyName.getName());
                reference.setRules(rules.getRuleSet());
            }

        } else if (name.equals("rule")) {
View Full Code Here

Examples of eu.ha3.matmos.engine.core.interfaces.Named

            new TimedEventInformation(
              entry.getKey(), this.providers.getMachine(), this.providers.getReferenceTime(), events,
              serial.delay_fadein, serial.delay_fadeout, serial.fadein, serial.fadeout);
        }
       
        Named element =
          new Machine(
            entry.getKey(), this.providers.getJunction(), asList(serial.allow), asList(serial.restrict),
            tie, stream);
        this.elements.add(element);
      }
View Full Code Here

Examples of javax.annotation.Named

     * @param component configuring web beans component
     * @param defaultName default name of the web bean
     */
    public static <T> void defineName(AbstractComponent<T> component, Annotation[] anns, String defaultName)
    {
        Named nameAnnot = null;
        boolean isDefault = false;
        for (Annotation ann : anns)
        {
            if (ann.annotationType().equals(Named.class))
            {
                nameAnnot = (Named) ann;
                break;
            }
        }

        if (nameAnnot == null) // no @Named
        {
            // Check for stereottype
            if (WebBeansUtil.isNamedExistOnStereoTypes(component))
            {
                isDefault = true;
            }

        }
        else
        // yes @Named
        {
            if (nameAnnot.value().equals(""))
            {
                isDefault = true;
            }
            else
            {
                component.setName(nameAnnot.value());
            }

        }

        if (isDefault)
View Full Code Here

Examples of javax.inject.Named

    InjectManager beanManager = InjectManager.create();
   
    Set<Bean<?>> beans;

    if (name != null) {
      Named named = Names.create(name);

      beans = beanManager.getBeans(type, named);
    }
    else {
      beans = beanManager.getBeans(type);
View Full Code Here

Examples of javax.inject.Named

  private DataSource loadDataSource(String name)
  {
    if (name == null)
      return null;
   
    Named named = Names.create(name);
    InjectManager beanManager = InjectManager.create();
   
    Set<Bean<?>> beans = beanManager.getBeans(DataSource.class, named);
   
    if (beans != null && beans.size() > 0) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.