Package java.beans

Examples of java.beans.DefaultPersistenceDelegate


    /*
     * Test the method getValue() with a protected method but within java.beans
     * package.
     */
    public void testGetValue_ProtectedMethodWithPackage() throws Exception {
        DefaultPersistenceDelegate dpd = new DefaultPersistenceDelegate();
        Object[] arguments = new Object[] { "test", "test" };
        Expression t = new Expression(dpd, "mutatesTo", arguments);
        try {
            t.getValue();
            fail("Should throw NoSuchMethodException!");
View Full Code Here


        });

        try {
            final Object object = new Object();
            e.setPersistenceDelegate(AType.class,
                    new DefaultPersistenceDelegate() {
                        @SuppressWarnings("unchecked")
                        @Override
                        protected void initialize(Class type,
                                Object oldInstance, Object newInstance,
                                Encoder out) {
View Full Code Here

   */
  public static <C> void addDelegateForConstructor(
      Class<? super C> classToBePersisted,
      final IConstructorParameterProvider<C> parameterProvider) {

    PersistenceDelegate delegate = new DefaultPersistenceDelegate() {

      @Override
      @SuppressWarnings("unchecked")
      // no way of checking it here
      protected Expression instantiate(Object oldInstance, Encoder out) {
View Full Code Here

   *           the exception
   */
  @Override
  protected void setUp() throws Exception {
    super.setUp();
    delegate = new DefaultPersistenceDelegate();
  }
View Full Code Here

    }

    protected void initialize(XMLEncoder encoder) {
        encoder.setPersistenceDelegate(
                OuterClass.InnerClass.class,
                new DefaultPersistenceDelegate() {
                    protected Expression instantiate(Object oldInstance, Encoder out) {
                        OuterClass.InnerClass inner = (OuterClass.InnerClass) oldInstance;
                        OuterClass outer = inner.getOuter();
                        return new Expression(inner, outer, "getInner", new Object[0]);
                    }
View Full Code Here

import java.util.Date;

public class Test4968523 {
    public static void main(String[] args) {
        String[] names = {"time"};
        test(Date.class, new DefaultPersistenceDelegate(names));
        test(null, new DefaultPersistenceDelegate());
    }
View Full Code Here

        return new A();
    }

    protected void initialize(XMLEncoder encoder) {
        encoder.setExceptionListener(this);
        encoder.setPersistenceDelegate(C.class, new DefaultPersistenceDelegate() {
            protected Expression instantiate(Object oldInstance, Encoder out) {
                C c = (C) oldInstance;
                return new Expression(c, c.getX(), "createC", new Object[] {});
            }
        });
View Full Code Here

        ByteArrayOutputStream output = new ByteArrayOutputStream();

        XMLEncoder encoder = new XMLEncoder(output);
        encoder.setPersistenceDelegate(
                object.getClass(),
                new DefaultPersistenceDelegate(new String[] {"value"}));

        encoder.writeObject(object);
        encoder.close();

        System.out.print(output);
View Full Code Here

    if(equals(otherValue)) return 0;
    return 1;
  }

  public static PersistenceDelegate getDelegate() {
    return new DefaultPersistenceDelegate(new String[]{"mCurrencyType", "mValue"});
  }
View Full Code Here

TOP

Related Classes of java.beans.DefaultPersistenceDelegate

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.