Tabnine Logo
me.prettyprint.hom.annotations
Code IndexAdd Tabnine to your IDE (free)

How to use me.prettyprint.hom.annotations

Best Java code snippets using me.prettyprint.hom.annotations (Showing top 18 results out of 315)

origin: hector-client/hector

public EntityManagerImpl(Keyspace keyspace, String[] classpathPrefix) {
 this(keyspace, new DefaultAnnotationScanner(), classpathPrefix);
}
origin: hector-client/hector

private void initializeClasspath(AnnotationScanner scanner, String classpathPrefix) {
 Set<Class<?>> classSet = scanner.scan(classpathPrefix, Entity.class);
 for (Class<?> clazz : classSet) {
  cacheMgr.initializeCacheForClass(clazz);
 }
}
origin: hector-client/hector

@Entity
@Table(name = "AnonumousColumnFamily")
@AnonymousPropertyHandling(type = Drawer.class, serializer = ObjectSerializer.class, adder = "addAnonymousProp", getter = "getAnonymousProps")
public class AnonymousWithCustomType {
 private Map<String, Drawer> anonymousProps = new HashMap<String, Drawer>();

 @Id
 private long id;

 public void addAnonymousProp(String name, Drawer value) {
  anonymousProps.put(name, value);
 }

 public Collection<Entry<String, Drawer>> getAnonymousProps() {
  return anonymousProps.entrySet();
 }

 public long getId() {
  return id;
 }

 public void setId(long id) {
  this.id = id;
 }
}

origin: hector-client/hector

private <T> void parseInheritanceAnnotation(AnonymousPropertyHandling anno,
  CFMappingDef<T> cfMapDef) {
 cfMapDef.setAnonymousValueType(anno.type());
 try {
  cfMapDef.setAnonymousValueSerializer(instantiateSerializer(anno.serializer()));
 } catch (Throwable e) {
  throw new HectorObjectMapperException(
    "exception while instantiating anonymous converter for class, " + cfMapDef.getRealClass()
      + ", with converter type, " + anno.serializer(), e);
  addMeth = cfMapDef.getRealClass().getMethod(anno.adder(), String.class, anno.type());
 } catch (NoSuchMethodException e) {
  throw new HectorObjectMapperException("Could not find anonymous add handler for class, "
    + cfMapDef.getRealClass() + ", with anonymous value type, " + anno.type());
 } catch (Throwable e) {
  throw new HectorObjectMapperException(
    "exception while finding anonymous add handler for class, " + cfMapDef.getRealClass()
      + ", with anonymous value type, " + anno.type(), e);
  getMeth = cfMapDef.getRealClass().getMethod(anno.getter());
 } catch (NoSuchMethodException e) {
  throw new HectorObjectMapperException("Could not find anonymous get handler for class, "
origin: hector-client/hector

@Test
public void testScanForAnnotation() {
 AnnotationScanner scanner = new DefaultAnnotationScanner();
 Set<Class<?>> classSet = scanner.scan("me.prettyprint.hom.beans", javax.persistence.Entity.class);
origin: hector-client/hector

@Entity
@Table(name = "MyCollectionBean")
class CollectionBean {
 @Column(name="mySet")
 private Set<Integer> mySet = new HashSet<Integer>();

 public Set<Integer> getMySet() {
  return mySet;
 }

 public void setMySet(Set<Integer> mySet) {
  this.mySet = mySet;
 }

 public CollectionBean addItem(Integer myInt) {
  mySet.add(myInt);
  return this;
 }

}

origin: hector-client/hector

 private void processColumnCustomAnnotation(Field f, me.prettyprint.hom.annotations.Column anno,
   PropertyDescriptor pd, CFMappingDef<?> cfMapDef) throws InstantiationException,
   IllegalAccessException {
  PropertyMappingDefinition md = new PropertyMappingDefinition(pd, anno.name(), anno.converter());
  
  // if collection type and default converter then make note of collection type for later use
  Class<?> type = pd.getPropertyType();
  if (Collection.class.isAssignableFrom(type) && md.isDefaultConverter()) {
   md.setCollectionType(type);
  }
  
  cfMapDef.addPropertyDefinition(md);
 }
}
origin: hector-client/hector

@Entity
@Table(name = "AnonumousColumnFamily")
@AnonymousPropertyHandling(type = Long.class, serializer = LongSerializer.class, adder = "addAnonymousProp", getter = "getAnonymousProps")
class AnonymousWithLongSerializer {
 private Map<String, Long> anonymousProps = new HashMap<String, Long>();
 public void addAnonymousProp(String name, Long value) {
  anonymousProps.put(name, value);
 }
 public Collection<Entry<String, Long>> getAnonymousProps() {
  return anonymousProps.entrySet();
 }
}
origin: hector-client/hector

private <T> void processIdCustomAnnotation(Field f, me.prettyprint.hom.annotations.Id anno,
  CFMappingDef<T> cfMapDef, Map<String, PropertyDescriptor> pdMap)
  throws InstantiationException, IllegalAccessException {
 // TODO lookup JPA 2 spec for class-level ids
 PropertyMappingDefinition md = new PropertyMappingDefinition(pdMap.get(f.getName()), null,
   anno.converter());
 if (null == md.getPropDesc() || null == md.getPropDesc().getReadMethod()
   || null == md.getPropDesc().getWriteMethod()) {
  throw new HectorObjectMapperException("@" + Id.class.getSimpleName()
    + " is defined on property, " + f.getName() + ", but its missing proper setter/getter");
 }
 cfMapDef.getKeyDef().addIdPropertyMap(md);
}
origin: hector-client/hector

public EntityManagerImpl(Keyspace keyspace, String classpathPrefix) {
 this(keyspace, new DefaultAnnotationScanner(), classpathPrefix);
}
origin: hector-client/hector

@Entity
@Table(name = "MyCustomCollectionBean")
class CustomConvertedCollectionBean {
 @Column(name="mySet", converter=ObjectConverter.class)
 private Set<Integer> mySet = new HashSet<Integer>();

 public Set<Integer> getMySet() {
  return mySet;
 }

 public void setMySet(Set<Integer> mySet) {
  this.mySet = mySet;
 }

 public CustomConvertedCollectionBean addItem(Integer myInt) {
  mySet.add(myInt);
  return this;
 }

}

origin: hector-client/hector

@Entity
@Table(name="TestColumnFamily")
@AnonymousPropertyHandling(adder="addAnonymousProp", getter="getAnonymousProps")
public class MyPojo {
 @Id
origin: hector-client/hector

private static AnnotationScanner createScanner(final String classname) {
 if (classname == null) {
  return new DefaultAnnotationScanner();
 }
 ClassLoader loader = Thread.currentThread().getContextClassLoader();
 if (loader == null) {
  loader = CassandraPersistenceProvider.class.getClassLoader();
 }
 AnnotationScanner scanner;
 try {
  scanner = (AnnotationScanner) loader.loadClass(classname).newInstance();
 } catch (Exception e) {
  scanner = new DefaultAnnotationScanner();
 }
 return scanner;
}
origin: hector-client/hector

@Entity
public abstract class MyAbstractGreenTestBean extends MyTestBean {
 @Column(name="myGreenStuff")
 private int myGreenStuff;
origin: hector-client/hector

@DiscriminatorValue("NoColor")
@Table(name = "TestBeanColumnFamily")
@AnonymousPropertyHandling(type=String.class, serializer=StringSerializer.class, adder="addAnonymousProp", getter="getAnonymousProps")
public class MyTestBean {
 @Id
origin: hector-client/hector

@Entity
@DiscriminatorValue("couch")
public class Couch extends Furniture {

 @Column(name="foldOutBed")
 private boolean foldOutBed;

 @Column(name="numCushions", converter=VariableIntegerConverter.class)
 private int numCushions;

 public boolean isFoldOutBed() {
  return foldOutBed;
 }

 public void setFoldOutBed(boolean foldOutBed) {
  this.foldOutBed = foldOutBed;
 }

 public int getNumCushions() {
  return numCushions;
 }

 public void setNumCushions(int numCushions) {
  this.numCushions = numCushions;
 }
}

origin: hector-client/hector

private String id;
@Column(name="mySet", converter=ObjectConverter.class)
private Collection<Integer> myCollection = new HashSet<Integer>();
origin: hector-client/hector

public class MyBlueTestBean extends MyTestBean {
 @Column(name="mySet")
 private Set<Integer> mySet = new HashSet<Integer>();
me.prettyprint.hom.annotations

Most used classes

  • AnnotationScanner
    Scan for classes annotated with an annotation. The scan starts in the given package root so it doesn
  • AnonymousPropertyHandling
  • Column
  • DefaultAnnotationScanner
    Scan for classes annotated with an annotation. The scan starts in the given package root so it doesn
  • Id
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now