Package net.sourceforge.javautil.common.reflection.cache

Examples of net.sourceforge.javautil.common.reflection.cache.ClassProperty


      IPassword pw = PasswordContext.get().getPassword(config.sourceName());
      if (pw == null) throw new IllegalArgumentException("No such password in current context locker: " + config.sourceName());
     
      key = pw.getPassword();
    } else {
      ClassProperty property = clazz.getProperty(EncryptionKey.class);
      if (property == null) throw new IllegalStateException("No encryption key property available for: " + clazz);
     
      key = ReflectionUtil.coerce(byte[].class, property.getValue(instance));
    }
   
    try {
      IEncryptionProvider provider = new SimpleEncryptionProvider(SimpleEncryptionKey.createUsing(Strength.STRONG, config == null ? "AES" : config.algorithm(), key));
      cache.put(clazz.getDescribedClass().getName(), new SoftReference<IEncryptionProvider>(provider));
View Full Code Here


  }

  public XMLDocumentElement createElement(XMLDocumentElement parent, XMLDocumentElementDefinition definition, Object instanceOverride) {
    boolean translate = false;
   
    ClassProperty type = definition.getProperty();
    if (type != null) {
      OneToOne oto = type.getAnnotation(OneToOne.class);
      if (oto != null) {
        if ("".equals( oto.mappedBy() )) translate = true; else return new XMLDocumentElementNoOp(parent, definition);
      }
      else if (type.getAnnotation(ManyToOne.class) != null) translate = true;
      else if (type.getAnnotation(OneToMany.class) != null) return new XMLDocumentElementNoOp(parent, definition);
      else if (type.getAnnotation(ManyToMany.class) != null) return new XMLDocumentElementNoOp(parent, definition);
     
      if (type.getAnnotation(Transient.class) != null) return new XMLDocumentElementNoOp(parent, definition);
    }
   
    return translate ? new JPAEntityElementReference(parent, definition, instanceOverride) : null;
  }
View Full Code Here

    visitor.visit(ctx);
    if (ctx.isContinue()) {
      ClassDescriptor descriptor = ClassCache.getFor(instance.getClass());
      Map<String, ClassProperty> properties = descriptor.getProperties();
      for (String name : properties.keySet()) {
        ClassProperty op = properties.get(name);
        Object value = op.getValue(instance);
       
        if (value == null) continue;
       
        if (op.getType().isArray()) {
          for (int i=0; i<Array.getLength(value); i++) {
            Object avalue = Array.get(value, i);
            if (avalue != null) accept(visitor, ctx.setVisited(avalue, op));
            if (ctx.isAborted()) break;
          }
View Full Code Here

   */
  public XMLDocumentElementDefinition getComplexProperty (String name) {
    if (!this.properties.containsKey(name) && !this.searchedAll) {
      Map<String, ClassProperty> properties = this.tagTypeDescriptor.getProperties();
      for (String propertyName : properties.keySet()) {
        ClassProperty property = this.tagTypeDescriptor.getProperty(propertyName);
        XMLDocumentElementDefinition xmlDef = new XMLDocumentElementDefinition(this, property);
        if (xmlDef.isXml()) {
          this.properties.put(xmlDef.getTagName(), xmlDef);
          if (name.equals(xmlDef.getTagName())) return xmlDef;
        }
View Full Code Here

 
  public XMLDocumentElementComplexType(XMLDocumentElement parent, XMLDocumentElementDefinition definition, T instance) {
    super(parent, definition);
    this.instance = ObjectManager.getManager(instance);
   
    ClassProperty parentMethod = this.instance.getDescriptor().getProperty(XmlParent.class);
    if (parentMethod != null) {
      XMLDocumentElement parentElement = this.getComplexParent(parent, parentMethod.getType());
      if (parentMethod != null) {
        parentMethod.setValue(instance, parentElement.getManager().getInstance());
      }
    }
  }
View Full Code Here

      Map<String,ClassProperty> props = desc1.getProperties();
      propertyNames = props.keySet().toArray(new String[props.size()]);
    }
   
    for (String propertyName : propertyNames) {
      ClassProperty property1 = desc1.getProperty(propertyName);
     
      assert property1 != null : "No such property: " + propertyName + " for " + desc1;
     
      ClassProperty property2 = desc2.getProperty(propertyName);
     
      assert property2 != null : "No such property: " + propertyName + " for " + desc2;
     
      if (!equals( property1.getValue(o1), property2.getValue(o2) )) return false;
    }
   
    return true;
  }
View Full Code Here

    List<String> prefixes = this.getSettingPrefixes();
    Map<String, String> parameters = webXml.getInitParameters();
    for (String name : properties.keySet()) {
      for (String prefix : prefixes) {
        if (parameters.containsKey(prefix + name)) {
          ClassProperty property = properties.get(name);
          property.setValue(this, ReflectionUtil.coerceString(property.getType(), parameters.get(prefix + name)));
          break;
        }
      }
    }
  }
View Full Code Here

            types.append(type.getSimpleName());
          }
          this.addRow(name, method.getReturnType(), types, method.isVariableArgument() ? "VarArgs" : "");
        }
      } else {
        ClassProperty property = (ClassProperty) members.get(name);
        this.addRow(name, property.getType(), property.isReadable() ? "Readable" : "", property.isWritable() ? "Writable" : "");
      }
    }
  }
View Full Code Here

TOP

Related Classes of net.sourceforge.javautil.common.reflection.cache.ClassProperty

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.