1 25 26 package org.objectweb.easybeans.deployment.annotations.metadata; 27 28 import java.util.Arrays ; 29 30 import org.objectweb.easybeans.deployment.annotations.impl.JAnnotationResource; 31 import org.objectweb.easybeans.deployment.annotations.impl.JEjbEJB; 32 import org.objectweb.easybeans.deployment.annotations.impl.JavaxPersistenceContext; 33 import org.objectweb.easybeans.deployment.annotations.impl.JavaxPersistenceUnit; 34 import org.objectweb.easybeans.deployment.annotations.metadata.interfaces.ISharedMetadata; 35 36 41 public class CommonAnnotationMetadata implements ISharedMetadata { 42 43 46 private JavaxPersistenceContext javaxPersistenceContext = null; 47 48 51 private JavaxPersistenceUnit javaxPersistenceUnit = null; 52 53 56 private JEjbEJB jEjbEJB = null; 57 58 61 private JAnnotationResource jAnnotationResource = null; 62 63 66 public JEjbEJB getJEjbEJB() { 67 return jEjbEJB; 68 } 69 70 74 public void setJEjbEJB(final JEjbEJB jEjbEJB) { 75 this.jEjbEJB = jEjbEJB; 76 } 77 78 82 public JAnnotationResource getJAnnotationResource() { 83 return jAnnotationResource; 84 } 85 86 91 public void setJAnnotationResource(final JAnnotationResource jAnnotationResource) { 92 this.jAnnotationResource = jAnnotationResource; 93 } 94 95 98 public boolean isPersistenceContext() { 99 return javaxPersistenceContext != null; 100 } 101 102 105 public JavaxPersistenceContext getJavaxPersistenceContext() { 106 return javaxPersistenceContext; 107 } 108 109 113 public void setJavaxPersistenceContext(final JavaxPersistenceContext javaxPersistenceContext) { 114 this.javaxPersistenceContext = javaxPersistenceContext; 115 } 116 117 120 public boolean isPersistenceUnit() { 121 return javaxPersistenceUnit != null; 122 } 123 124 127 public JavaxPersistenceUnit getJavaxPersistenceUnit() { 128 return javaxPersistenceUnit; 129 } 130 131 135 public void setJavaxPersistenceUnit(final JavaxPersistenceUnit javaxPersistenceUnit) { 136 this.javaxPersistenceUnit = javaxPersistenceUnit; 137 } 138 139 142 @Override 143 public String toString() { 144 StringBuilder sb = new StringBuilder (); 145 String titleIndent = " "; 146 sb.append(titleIndent); 148 sb.append(this.getClass().getName().substring(this.getClass().getPackage().getName().length() + 1)); 149 sb.append("[\n"); 150 151 concatStringBuilder("jEjbEJB", jEjbEJB, sb); 153 154 concatStringBuilder("jAnnotationResource", jAnnotationResource, sb); 156 157 concatStringBuilder("javaxPersistenceContext", javaxPersistenceContext, sb); 159 160 concatStringBuilder("javaxPersistenceUnit", javaxPersistenceUnit, sb); 162 163 sb.append(titleIndent); 164 sb.append("]\n"); 165 return sb.toString(); 166 } 167 168 175 protected static void concatStringBuilder(final String name, final Object object, final StringBuilder sb, 176 final String indent) { 177 if (object instanceof Boolean ) { 178 if (!((Boolean ) object).booleanValue()) { 180 return; 181 } 182 } 183 if (object != null) { 184 sb.append(indent); 185 sb.append(name); 186 sb.append("="); 187 if (object instanceof Object []) { 189 sb.append(Arrays.asList((Object []) object)); 190 } else { 191 sb.append(object); 192 } 193 sb.append("\n"); 194 } 195 } 196 197 203 protected static void concatStringBuilder(final String name, final Object object, final StringBuilder sb) { 204 concatStringBuilder(name, object, sb, " "); 205 } 206 207 } 208 | Popular Tags |