001    package org.granite.messaging.reflect;
002    
003    import java.lang.reflect.InvocationTargetException;
004    
005    public class NoopWritableProperty extends NullProperty {
006    
007            private final String name;
008            private final Class<?> type;
009            
010            public NoopWritableProperty(String name, Class<?> type) {
011                    if(name == null || type == null)
012                            throw new NullPointerException("name and type cannot be null");
013                    
014                    this.name = name;
015                    this.type = type;
016            }
017            
018            @Override
019            public String getName() {
020                    return name;
021            }
022    
023            @Override
024            public Class<?> getType() {
025                    return type;
026            }
027    
028            @Override
029            public boolean isWritable() {
030                    return true;
031            }
032    
033            @Override
034            public void setBoolean(Object holder, boolean value)
035                    throws IllegalArgumentException, IllegalAccessException,
036                    InvocationTargetException {
037            }
038    
039            @Override
040            public void setChar(Object holder, char value)
041                    throws IllegalArgumentException, IllegalAccessException,
042                    InvocationTargetException {
043            }
044    
045            @Override
046            public void setByte(Object holder, byte value)
047                    throws IllegalArgumentException, IllegalAccessException,
048                    InvocationTargetException {
049            }
050    
051            @Override
052            public void setShort(Object holder, short value)
053                    throws IllegalArgumentException, IllegalAccessException,
054                    InvocationTargetException {
055            }
056    
057            @Override
058            public void setInt(Object holder, int value)
059                    throws IllegalArgumentException, IllegalAccessException,
060                    InvocationTargetException {
061            }
062    
063            @Override
064            public void setLong(Object holder, long value)
065                    throws IllegalArgumentException, IllegalAccessException,
066                    InvocationTargetException {
067            }
068    
069            @Override
070            public void setFloat(Object holder, float value)
071                    throws IllegalArgumentException, IllegalAccessException,
072                    InvocationTargetException {
073            }
074    
075            @Override
076            public void setDouble(Object holder, double value)
077                    throws IllegalArgumentException, IllegalAccessException,
078                    InvocationTargetException {
079            }
080    
081            @Override
082            public void setObject(Object holder, Object value)
083                    throws IllegalArgumentException, IllegalAccessException,
084                    InvocationTargetException {
085            }
086    
087            @Override
088            public int hashCode() {
089                    return name.hashCode() + type.hashCode();
090            }
091    
092            @Override
093            public boolean equals(Object obj) {
094                    if (obj == this)
095                            return true;
096                    if (!(obj instanceof NoopWritableProperty))
097                            return false;
098                    return ((NoopWritableProperty)obj).name.equals(name) && ((NoopWritableProperty)obj).type.equals(type);
099            }
100    
101            @Override
102            public String toString() {
103                    return "NoopWritableProperty {name=" + name + ", type=" + type + "}";
104            }
105    }