001: /*
002: * Copyright 2004-2006 the original author or authors.
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016:
017: package org.compass.core.mapping.osem;
018:
019: import org.compass.core.accessor.Getter;
020: import org.compass.core.accessor.Setter;
021: import org.compass.core.mapping.AbstractResourcePropertyMapping;
022: import org.compass.core.mapping.Mapping;
023:
024: /**
025: * @author kimchy
026: */
027: public class ClassPropertyMetaDataMapping extends
028: AbstractResourcePropertyMapping implements ObjectMapping {
029:
030: private String accessor;
031:
032: private String propertyName;
033:
034: private String definedInAlias;
035:
036: private Getter getter;
037:
038: private Setter setter;
039:
040: public Mapping copy() {
041: ClassPropertyMetaDataMapping copy = new ClassPropertyMetaDataMapping();
042: super .copy(copy);
043: copy.setSetter(getSetter());
044: copy.setGetter(getGetter());
045: copy.setAccessor(getAccessor());
046: copy.setPropertyName(getPropertyName());
047: return copy;
048: }
049:
050: public boolean hasAccessors() {
051: return true;
052: }
053:
054: public boolean canBeCollectionWrapped() {
055: return false;
056: }
057:
058: public Getter getGetter() {
059: return getter;
060: }
061:
062: public void setGetter(Getter getter) {
063: this .getter = getter;
064: }
065:
066: public Setter getSetter() {
067: return setter;
068: }
069:
070: public void setSetter(Setter setter) {
071: this .setter = setter;
072: }
073:
074: /**
075: * Returns <code>true</code> if this type of property
076: * can act as the Java Bean Property meta-data id.
077: */
078: public boolean canActAsPropertyId() {
079: return ReverseType.NO == getReverse();
080: }
081:
082: public String getAccessor() {
083: return accessor;
084: }
085:
086: public void setAccessor(String accessor) {
087: this .accessor = accessor;
088: }
089:
090: public String getPropertyName() {
091: return propertyName;
092: }
093:
094: public void setPropertyName(String propertyName) {
095: this .propertyName = propertyName;
096: }
097:
098: public String getDefinedInAlias() {
099: return definedInAlias;
100: }
101:
102: public void setDefinedInAlias(String definedInAlias) {
103: this.definedInAlias = definedInAlias;
104: }
105: }
|