public ModelField getField(String modelClassName, String fieldName) { String shortName = this.getFactNameFromType( modelClassName ); ModelField[] fields = this.getModelFields().get( shortName ); if ( fields == null ) { return null; } for ( ModelField modelField : fields ) { if ( modelField.getName().equals( fieldName ) ) { return modelField; } } return null; }
public ModelField getField(String modelClassName, String fieldName) { String shortName = this.getFactNameFromType( modelClassName ); ModelField[] fields = this.getModelFields().get( shortName ); if ( fields == null ) { return null; } for ( ModelField modelField : fields ) { if ( modelField.getName().equals( fieldName ) ) { return modelField; } } return null; }
public String[] getModelFields(String modelClassName) { String shortName = this.getFactNameFromType( modelClassName ); if ( !this.getModelFields().containsKey( shortName ) ) { return new String[0]; } ModelField[] fields = this.getModelFields().get( shortName ); String[] fieldNames = new String[fields.length]; for ( int i = 0; i < fields.length; i++ ) { fieldNames[i] = fields[i].getName(); } return fieldNames; }
public String[] getModelFields(String modelClassName) { String shortName = this.getFactNameFromType( modelClassName ); if ( !this.getModelFields().containsKey( shortName ) ) { return new String[0]; } ModelField[] fields = this.getModelFields().get( shortName ); String[] fieldNames = new String[fields.length]; for ( int i = 0; i < fields.length; i++ ) { fieldNames[i] = fields[i].getName(); } return fieldNames; }
public String[] getModelFields(FieldAccessorsAndMutators accessorOrMutator, String modelClassName) { String shortName = this.getFactNameFromType( modelClassName ); if ( !this.getModelFields().containsKey( shortName ) ) { return new String[0]; } ModelField[] fields = this.getModelFields().get( shortName ); List<String> fieldNames = new ArrayList<String>(); for ( int i = 0; i < fields.length; i++ ) { String fieldName = fields[i].getName(); if ( FieldAccessorsAndMutators.compare( accessorOrMutator, this.accessorsAndMutators.get( shortName + "." + fieldName ) ) ) { fieldNames.add( fieldName ); } } return fieldNames.toArray( new String[fieldNames.size()] ); }
public String[] getModelFields(FieldAccessorsAndMutators accessorOrMutator, String modelClassName) { String shortName = this.getFactNameFromType( modelClassName ); if ( !this.getModelFields().containsKey( shortName ) ) { return new String[0]; } ModelField[] fields = this.getModelFields().get( shortName ); List<String> fieldNames = new ArrayList<String>(); for ( int i = 0; i < fields.length; i++ ) { String fieldName = fields[i].getName(); if ( FieldAccessorsAndMutators.compare( accessorOrMutator, this.accessorsAndMutators.get( shortName + "." + fieldName ) ) ) { fieldNames.add( fieldName ); } } return fieldNames.toArray( new String[fieldNames.size()] ); }
/** * Returns fact's name from class type * * @param type * @return */ public String getFactNameFromType(String type) { if ( type == null ) { return null; } if ( getModelFields().containsKey( type ) ) { return type; } for ( Map.Entry<String, ModelField[]> entry : getModelFields().entrySet() ) { for ( ModelField mf : entry.getValue() ) { if ( TYPE_THIS.equals( mf.getName() ) && type.equals( mf.getClassName() ) ) { return entry.getKey(); } } } return null; }
/** * Returns fact's name from class type * * @param type * @return */ public String getFactNameFromType(String type) { if ( type == null ) { return null; } if ( getModelFields().containsKey( type ) ) { return type; } for ( Map.Entry<String, ModelField[]> entry : getModelFields().entrySet() ) { for ( ModelField mf : entry.getValue() ) { if ( TYPE_THIS.equals( mf.getName() ) && type.equals( mf.getClassName() ) ) { return entry.getKey(); } } } return null; }