| Classes in this File | Line Coverage | Branch Coverage | Complexity | |||||||
| ObjectReferenceDescriptor |
|
| 1.0;1 |
| 1 | /* |
|
| 2 | * Copyright 2004 Chris Nelson |
|
| 3 | * |
|
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
|
| 5 | * you may not use this file except in compliance with the License. |
|
| 6 | * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 |
|
| 7 | * Unless required by applicable law or agreed to in writing, |
|
| 8 | * software distributed under the License is distributed on an "AS IS" BASIS, |
|
| 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
| 10 | * See the License for the specific language governing permissions and limitations under the License. |
|
| 11 | */ |
|
| 12 | package org.trails.descriptor; |
|
| 13 | ||
| 14 | /** |
|
| 15 | * This class represents a to-one association and is created by HibernateDescriptorDecorator |
|
| 16 | * |
|
| 17 | * @author Chris Nelson |
|
| 18 | * @see HibernateDescriptorDecorator |
|
| 19 | */ |
|
| 20 | public class ObjectReferenceDescriptor extends TrailsPropertyDescriptor |
|
| 21 | { |
|
| 22 | private Class actualType; |
|
| 23 | ||
| 24 | public ObjectReferenceDescriptor(Class beanType, IPropertyDescriptor descriptor, |
|
| 25 | Class actualType) |
|
| 26 | { |
|
| 27 | 4 | this(beanType, descriptor.getPropertyType(), actualType); |
| 28 | 4 | copyFrom(descriptor); |
| 29 | 4 | } |
| 30 | ||
| 31 | /** |
|
| 32 | * @param realDescriptor |
|
| 33 | */ |
|
| 34 | public ObjectReferenceDescriptor( |
|
| 35 | Class beanType, Class declaredType, Class actualType) |
|
| 36 | { |
|
| 37 | 8 | super(beanType, declaredType); |
| 38 | 8 | this.actualType = actualType; |
| 39 | 8 | } |
| 40 | ||
| 41 | /* (non-Javadoc) |
|
| 42 | * @see org.trails.descriptor.PropertyDescriptor#getPropertyType() |
|
| 43 | */ |
|
| 44 | public Class getPropertyType() |
|
| 45 | { |
|
| 46 | 8 | return actualType; |
| 47 | } |
|
| 48 | ||
| 49 | /* (non-Javadoc) |
|
| 50 | * @see org.trails.descriptor.PropertyDescriptor#isObjectReference() |
|
| 51 | */ |
|
| 52 | public boolean isObjectReference() |
|
| 53 | { |
|
| 54 | 0 | return true; |
| 55 | } |
|
| 56 | ||
| 57 | public Object clone() |
|
| 58 | { |
|
| 59 | 4 | return new ObjectReferenceDescriptor(getBeanType(), this, getPropertyType()); |
| 60 | } |
|
| 61 | } |